Python Forum
[PyGame] Need Help With My PYgame Script
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[PyGame] Need Help With My PYgame Script
#2
1. indentation is off. KEYUP will never be called in KEYDOWN.
You should check into keys states.
# Keys state. still need pygame.event.get() or pygame.event.pump() before getting states.
keyspressed = pygame.key.get_pressed()
if keyspressed[pygame.LEFT]:
    x -=5
if keyspressed[pygame.RIGHT]:
    x += 5
# etc
2. pygame has builtin colors
import pygame
print(pygame.color.THECOLORS.keys())
print()
print(pygame.Color('red'))
99 percent of computer problems exists between chair and keyboard.
Reply


Messages In This Thread
Need Help With My PYgame Script - by ghost0fkarma - Dec-17-2017, 01:21 AM
RE: Need Help With My PYgame Script - by Windspar - Dec-17-2017, 01:57 AM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020