Advertisement
Virtual_Universe

Platformer_ComputerCraft

Aug 8th, 2015
382
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. x = 1
  2. y = 5
  3. local function grav()
  4.   if y<19 then
  5.       y = y+1
  6.   end
  7. end
  8.  
  9. local function input()
  10.   local event, key = os.pullEvent("key")
  11.     if key == keys.d then
  12.       x=x+1
  13.       paintutils.drawPixel(x-1,y,32768)
  14.     end
  15.     if key == keys.a then
  16.       x=x-1
  17.      paintutils.drawPixel(x+1,y,32768)
  18.     end
  19.     if key == keys.w then
  20.        y=y-2
  21.        paintutils.drawPixel(x,y+2,32768)
  22.     end
  23. end
  24. local function draw()
  25.   paintutils.drawPixel(x,y,8)
  26.   sleep(0.02)
  27.   paintutils.drawPixel(x,y,32768)
  28.   grav()
  29. end
  30. while true do
  31.   parallel.waitForAny(input,draw)
  32. end
Advertisement
RAW Paste Data Copied
Advertisement