Rectangle Disappearing After a few Seconds

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
GraVeu
Prole
Posts: 2
Joined: Mon Jul 25, 2016 11:27 pm

Rectangle Disappearing After a few Seconds

Post by GraVeu »

Hi!

This is my first forum post so I hope I do everything correctly.

I'm relatively new to Love so I am trying to make a simple movement system for a white rectangle. The code is as follows

Code: Select all

function love.load()
  player={} --Configuration for the player
  player.x=350
  player.y=100
  player.width=40
  player.height=40
  player.speed=6
  player.bullets={}

  
end

function love.update(dt)

if love.keyboard.isDown("left") then
  player.x=player.x-player.speed
elseif love.keyboard.isDown("right") then
  player.x=player.x+player.speed
elseif love.keyboard.isDown("down") then
  player.y=player.y+player.speed
elseif love.keyboard.isDown("up") then 
  player.y=player.y-player.speed
end 
end



function love.draw()

love.graphics.rectangle("fill",player.x,player.y,player.width,player.height)




end


It works great, the rectangle moves when the desired buttons are pressed, except that after about 20 seconds, it just disappears. This does not happen on my laptop, which I tested on to make sure it wasn't my code.

My computers specifications are as follows

- Intel i3 4160
-AMD R9 270
-1TB HDD
-AsRock H97 Anniversary MOBO

That is all I can possibly think of that would affect this. On a side note, my monitor has dead pixels all over it but this has a 0.1% chance of affecting my code.

Anybody have any solutions?
User avatar
Plu
Inner party member
Posts: 722
Joined: Fri Mar 15, 2013 9:36 pm

Re: Rectangle Disappearing After a few Seconds

Post by Plu »

Any chance you could stop the code in a debugger after the rectangle disappears to see if all the variables are still set properly?
User avatar
pgimeno
Party member
Posts: 3640
Joined: Sun Oct 18, 2015 2:58 pm

Re: Rectangle Disappearing After a few Seconds

Post by pgimeno »

Works fine for me. I don't think it's the code.

There's the issue this guy had, which may be unrelated or not but it happens to be the same AMD model (and no one else could reproduce it - maybe you can):
https://www.love2d.org/forums/viewtopic.php?f=4&t=81988

And this guy doesn't say the model but it was an AMD too, and it looks like the issue you're having:
https://www.love2d.org/forums/viewtopic.php?f=4&t=82254

It's likely to be driver problem.
GraVeu
Prole
Posts: 2
Joined: Mon Jul 25, 2016 11:27 pm

Re: Rectangle Disappearing After a few Seconds

Post by GraVeu »

pgimeno wrote:Works fine for me. I don't think it's the code.

There's the issue this guy had, which may be unrelated or not but it happens to be the same AMD model (and no one else could reproduce it - maybe you can):
https://www.love2d.org/forums/viewtopic.php?f=4&t=81988

And this guy doesn't say the model but it was an AMD too, and it looks like the issue you're having:
https://www.love2d.org/forums/viewtopic.php?f=4&t=82254

It's likely to be driver problem.
It seems to have something to do with extra features in AMD cards, I'll look into it. Thanks for the links.
bobbyjones
Party member
Posts: 730
Joined: Sat Apr 26, 2014 7:46 pm

Re: Rectangle Disappearing After a few Seconds

Post by bobbyjones »

Maybe it's moving off the screen. You aren't using dt so it's moving 6 pixels each frame at 360 pixels a second (if vsync is enabled). Maybe it's just flying off the screen. If you don't have vsync enabled it could have likely been a fps spike. (I'm not a graphics programmer so maybe it can indeed be a driver bug.)

Edit: just read the other forum posts that were linked. Probably should disregard this.
User avatar
desman
Prole
Posts: 31
Joined: Fri Jul 08, 2016 7:31 am
Location: JKT48, Indonesia

Re: Rectangle Disappearing After a few Seconds

Post by desman »

I use AMD Radeon HD 6790 (Catalyst 14.12) and works fine on my pc.

Perhaps you need your update GPU driver to the latest version.
Post Reply

Who is online

Users browsing this forum: No registered users and 6 guests