TORONTO KIDS COMPUTER CLUB | Aurora Saturday 13:00 Python Practice 02.20.
19087
post-template-default,single,single-post,postid-19087,single-format-standard,ajax_fade,page_not_loaded,,qode-theme-ver-7.6.2,wpb-js-composer js-comp-ver-6.8.0,vc_responsive

Aurora Saturday 13:00 Python Practice 02.20.

23 Feb Aurora Saturday 13:00 Python Practice 02.20.

Question:
Modify the program we made in the class to:

switch the weapon between missile and laser by press 1 or 2

Hint:

we tried using keyboard to control the fighter using the following code:

# keyboard control
elif event.type == pygame.KEYDOWN:
    if event.key == pygame.K_w:
        fighter.rect.top -= 20
    if event.key == pygame.K_s:
        fighter.rect.top += 20
    if event.key == pygame.K_a:
        fighter.rect.left -= 20
    if event.key == pygame.K_d:
        fighter.rect.left += 20

No Comments

Sorry, the comment form is closed at this time.