Guest User

Untitled

a guest
Apr 23rd, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.56 KB | None | 0 0
  1. x=200
  2. y=130
  3. rojo=color.new(255,0,0)
  4. --Creamos las variables e iniciamos el Bucle
  5.  
  6. while true do
  7. --Lectura de controles
  8. controls.read()
  9.  
  10. --Lectura de botones
  11. if controls.press("up") then y=y-1 elseif controls.press("down") then y=y+1 end
  12. if controls.press("left") then x=x-1 elseif controls.press("right") then x=x+1 end
  13.  
  14. --Dibujamos un rectangulo en las variables
  15. draw.fillrect(x,y,20,20,rojo)
  16.  
  17. --Actualizamos
  18. screen.flip()
  19.  
  20. --Si pulsas START provocarás un error (Para no tener que salir del Homebrew =)
  21. if controls.start() then broke() end
  22. end
Add Comment
Please, Sign In to add comment