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?