Created
February 24, 2021 10:32
-
-
Save subtra3t/ba5bc9024f43c6ad8feb55b485f9cd4a to your computer and use it in GitHub Desktop.
Revisions
-
subtra3t created this gist
Feb 24, 2021 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,36 @@ -- A simple enlarging rectangle that stays in the middle of the screen -- Made with the LOVE 2D framework in Lua data = { x = 300, y = 250, width = 200, height = 100, speed = 50 } function love.draw() love.graphics.rectangle("line", data.x, data.y, data.width, data.height) end function love.update(dt) if data.width > data.height then data.x = data.x - ((data.speed / 2) * dt) data.width = data.width + (data.speed * dt) data.y = data.y - ((data.speed / 2) * dt) data.height = data.height + (data.speed * dt) else data.x = data.x - ((data.speed / 2) * dt) data.width = data.width + (data.speed * dt) data.y = data.y - ((data.speed / 2) * dt) data.height = data.height + (data.speed * dt) end if love.keyboard.isDown("up") then data.speed = data.speed * 1.1 elseif love.keyboard.isDown("down") then data.speed = data.speed / 1.1 end end