This is a draft cheat sheet. It is a work in progress and is not finished yet.
Working Example - Code
TITLE = 'Alien Click'
WIDTH = 500
HEIGHT = 200
alien = Actor('alien')
alien.pos = (0, HEIGHT//2)
def draw():
screen.clear()
alien.draw()
def update():
alien.left += 2
if alien.left > WIDTH:
alien.right = 0
def on_mouse_down(pos):
if alien.collidepoint(pos):
alien.image = 'alien_hurt'
sounds.eep.play()
animate(alien, tween='accelerate',
on_finished=set_alien_back,
pos=(alien.x+200, alien.y))
def set_alien_back():
alien.image = 'alien'
|
Behind the Scene
while game_has_not_ended():
process_input()
update()
draw()
|
|
|
Keyboard Button
BACKSPACE |
TAB |
CLEAR |
RETURN |
PAUSE |
ESCAPE |
SPACE |
EXCLAIM |
QUOTEDBL |
HASH |
DOLLAR |
AMPERSAND |
QUOTE |
LEFTPAREN |
RIGHTPAREN |
ASTERISK |
PLUS |
COMMA |
MINUS |
PERIOD |
SLASH |
K_0 |
K_1 |
K_2 |
K_3 |
K_4 |
K_5 |
K_6 |
K_7 |
K_8 |
K_9 |
COLON |
SEMICOLON |
LESS |
EQUALS |
GREATER |
QUESTION |
AT |
LEFTBRACKET |
BACKSLASH |
RIGHTBRACKET |
CARET |
UNDERSCORE |
BACKQUOTE |
|