--[[------------------------------------- - Interacting with screen boundaries. - Mithat Konar -------------------------------------]]-- -------------------- -- LÖVE functions -- -------------------- --[[ Create game globals and initial conditions. ]]-- function love.load() -- circle's constants CIRCLE_SIZE = 30 CIRCLE_H_SPEED = 100 -- circle's variables circleX = CIRCLE_SIZE -- put circle in upper left of screen circleY = CIRCLE_SIZE -- put circle in upper left of screen isMoveRight = true -- whether the circle is moving right or left (only needed for bounce) end --[[ Update values of game parameters. ]]-- function love.update(dt) -- "clip" the motion circleX = circleX + CIRCLE_H_SPEED * dt if circleX > (love.graphics.getWidth() - CIRCLE_SIZE) then circleX = love.graphics.getWidth() - CIRCLE_SIZE end end --[[ Render the game elements. ]]-- function love.draw() love.graphics.circle("fill", circleX, circleY, CIRCLE_SIZE) end