Advertisement
Guest User

Untitled

a guest
Jul 22nd, 2017
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.61 KB | None | 0 0
  1. local carre = Image.createEmpty(2,2)
  2. carre:clear(Color.new(255,0,0))
  3.  
  4. local x = 5
  5. local y = 100
  6.  
  7. while true do
  8.     screen:clear()
  9.     pad = Controls.read()
  10.  
  11.     if pad:left() then x = x - (x > 0 and 3 or 0) end
  12.     if pad:right() then x = x + (x < 480 and 3 or 0)  end
  13.     if pad:up() then y = y - (y > 0 and 3 or 0)  end
  14.     if pad:down() then y = y + (y < 272 and 3 or 0)  end
  15.  
  16.     screen:blit(x,y,carre)
  17.     screen:drawLine(470,0,470,272,Color.new(255,255,255))
  18.  
  19.     screen:print(5, 5, x >= 472 and "Tu Gagne!" or "Tu Perds !", x >= 472 and Color.new(0,255,0) or Color.new(255, 0, 0))
  20.    
  21.     screen.flip()
  22.     screen.waitVblankStart()
  23. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement