05 Oct Friday 17:00 Python Practice 20.10.02.
Posted at 01:45h in Uncategorized 0 Comments
We have created class Laser, however we haven’t put it into use, please make change in the main program so that the fighter can shoot laser when we press the mouse.
- create a pygame.sprite.Group() for all the lasers.
- every time you click down the mouse, the program will create the laser object and add the object to the laser group, we can use the following code to check if you click the mouse or not:
if True in pygame.mouse.get_pressed():
- do not forget to update every laser object in the laser group so the laser can move up
- do not forget to blit every leaser object in the laser group so the laser will be put to the game screen at correct location.
Sorry, the comment form is closed at this time.