Monday, September 24, 2012

Scoring and Gun Types


Son changed:

  • Scores for enemies landed and enemies shot
  • Change of gun between piston and shotgun
  • Aligned shotgun blast graphic with shotgun movement from left to right
  • Using three graphics for the shotgun for left, middle, right
  • Using three graphics for the pistol for left, middle right
Gun change is currently controlled by the keyboard.  Plan to switch this to Button 4 on the joystick.  Right now, there's a problem with repeating the button every time the program goes through a loop.  

Although there's many ways to set up a button delay, I'm going to show my student this method using python's time.time() library.




The above code snippet references my_joystick. It simply checks to see if 300 milliseconds have passed since the last time the gun was changed. get_button(3) will check the yellow button Y on the XBox 360 controller or the button labled 4 on the Logitech RumblePad 2



These shooter games are fairly easy for middle school children to build. They don't rely on lists and dictionaries as much as the memory puzzle game did. A shooter game primarily uses addition and subtraction of the rectangle coordinates. Using pygame's Rect, it is easy to check for collision of two rectangles.

 Just watched this video on Gimp Tutorial: Layers - The Basics.

No comments:

Post a Comment