Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- x=200
- y=130
- rojo=color.new(255,0,0)
- velocidad=2
- --Creamos las variables e iniciamos el Bucle
- x2=math.random(0,460)
- y2=math.random(0,252)
- while true do
- --Lectura de controles
- controls.read()
- --Lectura de botones
- if controls.up() then y=y-velocidad elseif controls.down() then y=y+velocidad end
- if controls.left() then x=x-velocidad elseif controls.right() then x=x+velocidad end
- --Dibujamos un rectangulo en las variables
- draw.fillrect(x,y,20,20,rojo)
- --Dibujamos otro en una zona aleatoria
- draw.fillrect(x2,y2,20,20,color.new(0,255,0))
- --Actualizamos
- screen.flip()
- --Si pulsas START provocarás un error (Para no tener que salir del Homebrew =)
- if controls.start() then broke() end
- end
Add Comment
Please, Sign In to add comment