Python Forum
[PyGame] Space Invaders Python Bug?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[PyGame] Space Invaders Python Bug?
#2
1) First of all include your images so we can run your program without tinkering with your code.
2) 99999/100000 times when you call out a bug in the language, its really you created the bug in your code, not a language bug
3) Using global keywords is notorious for bugs to creep in your code
4) use classes more. You have classes but the majority of the meat is outside of them. 

5) Your over complicating the rect process
Quote:        screen.blit(self.image, Rect(self.x, self.y, self.width, self.height))
pygame.Rect has x,y,width, and height attributes, and more. You are just making things redundant by not using them properly. As well as introducing possible bugs into your program. All the getters and setters are not needed as as you are just recreating the wheel by not using Rects to their full potential. 

pygame.Rect also has collision detection to identify a collision with another pygame.Rect which you should be using, but are not. 

Here is our tutorial in which demonstrates how to use rects
https://python-forum.io/Thread-PyGame-Ba...ing-part-3
Recommended Tutorials:
Reply


Messages In This Thread
Space Invaders Python Bug? - by CJMinecraft - Mar-15-2017, 03:07 PM
RE: Space Invaders Python Bug? - by metulburr - Mar-15-2017, 04:22 PM
RE: Space Invaders Python Bug? - by georgecoopers - Mar-31-2017, 03:37 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
Video [PyGame] Space Invaders in PyGame Russ_CW 5 5,037 Nov-22-2020, 12:21 PM
Last Post: Russ_CW
  [PyGame] newbie needs help with space invaders n0x 2 2,214 Jul-04-2020, 11:32 AM
Last Post: n0x

Forum Jump:

User Panel Messages

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