diff --git a/res/example.lua b/res/example.lua index 80dda8e..e6ede2f 100644 --- a/res/example.lua +++ b/res/example.lua @@ -60,9 +60,9 @@ function draw() for i, v in ipairs(squares) do v.x = v.x + v.vx v.y = v.y + v.vy - if v.x <= 0 then v.vx = 1; v.color = math.random(0xFFFFFF) end + if v.x == 0 then v.vx = 1; v.color = math.random(0xFFFFFF) end if v.x + SQUARE_WIDTH >= ly.width-1 then v.vx = -1; v.color = math.random(0xFFFFFF) end - if v.y <= 0 then v.vy = 1; v.color = math.random(0xFFFFFF) end + if v.y == 0 then v.vy = 1; v.color = math.random(0xFFFFFF) end if v.y + SQUARE_HEIGHT >= ly.height-1 then v.vy = -1; v.color = math.random(0xFFFFFF) end end timer = ly.clock()