daily pastebin goal
35%
SHARE
TWEET

Untitled

a guest Jul 17th, 2018 47 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. def handle_events(events, player, speed, controller):
  2.   c = { K_LEFT: move_left, K_RIGHT: move_right,
  3.            K_UP: move_up,     K_DOWN: move_down    }
  4.   if len(events) == 0:
  5.     return
  6.   else:
  7.     event = events.pop(0)
  8.     if event.type == KEYDOWN:
  9.       c.get(event.key, default)(player, speed)
  10.  
  11. Kör metoden utmärkt
  12.  
  13. --------------------------
  14.  
  15. def c():
  16.   return { K_LEFT: move_left, K_RIGHT: move_right,
  17.            K_UP: move_up,     K_DOWN: move_down    }
  18.  
  19. def handle_events(events, player, speed, controller):
  20.   if len(events) == 0:
  21.     return
  22.   else:
  23.     event = events.pop(0)
  24.     if event.type == KEYDOWN:
  25.       c().get(event.key, default)(player, speed)
  26.  
  27. dict is not callable
  28. Varför?
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top