# Examples These examples are made from memory on how the engine works, if one of these examples do not work you could make an issue on the the [Issues Tab](https://github.com/pyudev-x/goblocks/issues)! ## Moving Sun Let the sun move across the screen! ```lua function Setup() Wow = newCircle() Wow:setPos({0, 110}) Wow:setColor("yellow") Wow:setRadius(40) Where = 1 end function Update(dt) if Wow:getPos()[1] > 880 then Where = -1 elseif Wow:getPos()[1] < 0 then Where = 1 end end function Draw() Wow:draw() local pos = Wow:getPos() pos[1] = pos[1] + Where*5 Wow:setPos(pos) end ``` ## Moving Player Setup a simple player to move around! ```lua function Setup() Player = newPlayer() Player:setPos({660, 440}) end function Update(dt) Player:setVelocity({0, 0}) end function Draw() Player:draw() -- The player will automatically move when pressing -WASD- end ``` ## Hello! The example you *might of* saw on the [README](./README.md)! ```lua function Setup() end function Update(dt) end function Draw() hello() end ``` ## Growing Circle Make a circle that will grow over time! ```lua function Setup() Circle = newCircle() Circle:setRadius(1) Circle:setColor("lime") end function Update(dt) Circle:setRadius(Circle:getRadius()+1) end function Draw() Circle:draw() end ``` ## Sounds, Text and Input Use sounds, text and input all together! ```lua function Setup() Text = newText() Sound = newSound() Sound:loadSound("/path/to/sound") Text:setText("Sound played 0 times!") Times = 0 end function Update(dt) if isKeyPressed("space") then Times = Times + 1 Sound:playSound() Text:setText("Sound played " .. Times .. " times!") end end function Draw() Text:draw() end ```