Introduction to Jam’s Video Game PackageThe PlanScope of the Video Game PackageBasic Design of the Video Game PackageSlide 5Slide 6Slide 7Slide 8Slide 9Slide 10Slide 11Slide 12Slide 13Steps to Making a GameSlide 15How Pong was MadeSlide 17Slide 18Slide 19Slide 20Slide 21Last Edited 1/10/04 CPS4: Java for Video Gameshttp://www.cs.duke.edu/education/courses/spring04/cps004/calendar.htmlVideo Game Package Intro 1Introduction to Jam’sVideo Game PackageLast Edited 1/10/04 CPS4: Java for Video Gameshttp://www.cs.duke.edu/education/courses/spring04/cps004/calendar.htmlVideo Game Package Intro 2The Plan•Scope of Video Game Package•Basic Design of the Video Game Package•Steps to making a game•How the Pong was made•Limitations of the Video Game PackageLast Edited 1/10/04 CPS4: Java for Video Gameshttp://www.cs.duke.edu/education/courses/spring04/cps004/calendar.htmlVideo Game Package Intro 3Scope of the Video Game Package•Goals of Jam’s Video Game Package–Simple to use–Reasonably fast–Designed to be examined and modified for academic purposes in computer science courses•What Jam’s package is not designed for–High speed animation/user input–Scripting games–Complex gamesLast Edited 1/10/04 CPS4: Java for Video Gameshttp://www.cs.duke.edu/education/courses/spring04/cps004/calendar.htmlVideo Game Package Intro 4Basic Design of theVideo Game PackageAnimationCanvasKeyboardMouseGameLoopJFrameOrAppletTrackerSpriteTrackerSpriteTrackerSpriteLast Edited 1/10/04 CPS4: Java for Video Gameshttp://www.cs.duke.edu/education/courses/spring04/cps004/calendar.htmlVideo Game Package Intro 5Basic Design of theVideo Game PackageTrackerThe Tracker is whatMakes the BallSprite moveLast Edited 1/10/04 CPS4: Java for Video Gameshttp://www.cs.duke.edu/education/courses/spring04/cps004/calendar.htmlVideo Game Package Intro 6Basic Design of theVideo Game Package•Point2D.Double getLocation()•double getScaleFactor()•double getRotationAddition()•void advanceTime()TrackerLast Edited 1/10/04 CPS4: Java for Video Gameshttp://www.cs.duke.edu/education/courses/spring04/cps004/calendar.htmlVideo Game Package Intro 7Basic Design of theVideo Game PackageTrackerSpriteLast Edited 1/10/04 CPS4: Java for Video Gameshttp://www.cs.duke.edu/education/courses/spring04/cps004/calendar.htmlVideo Game Package Intro 8Basic Design of theVideo Game PackageHas instance variables, and mutator and accessor methods for:•Shape•Location•Size•Rotation•ColorTrackerSpriteLast Edited 1/10/04 CPS4: Java for Video Gameshttp://www.cs.duke.edu/education/courses/spring04/cps004/calendar.htmlVideo Game Package Intro 9Basic Design of theVideo Game PackageAnimationCanvasTrackerSpriteTrackerSpriteTrackerSpriteLast Edited 1/10/04 CPS4: Java for Video Gameshttp://www.cs.duke.edu/education/courses/spring04/cps004/calendar.htmlVideo Game Package Intro 10Basic Design of theVideo Game PackageAnimationCanvasis a JPanel•with a collection of Sprites•that paints itself by painting all of its Sprites AnimationCanvasTrackerSpriteTrackerSpriteTrackerSpriteLast Edited 1/10/04 CPS4: Java for Video Gameshttp://www.cs.duke.edu/education/courses/spring04/cps004/calendar.htmlVideo Game Package Intro 11Basic Design of theVideo Game PackageGameLoop adds:•animation•interaction via–Keyboard–MouseKeyboardMouseGameLoopAnimationCanvasTrackerSpriteTrackerSpriteTrackerSpriteLast Edited 1/10/04 CPS4: Java for Video Gameshttp://www.cs.duke.edu/education/courses/spring04/cps004/calendar.htmlVideo Game Package Intro 12Basic Design of theVideo Game PackageJFrame or Applet used to:•Put the game on the screen•Start the game•Provide game controlJFrameOrAppletLast Edited 1/10/04 CPS4: Java for Video Gameshttp://www.cs.duke.edu/education/courses/spring04/cps004/calendar.htmlVideo Game Package Intro 13Basic Design of theVideo Game PackageAnimationCanvasKeyboardMouseGameLoopJFrameOrAppletTrackerSpriteTrackerSpriteTrackerSpriteLast Edited 1/10/04 CPS4: Java for Video Gameshttp://www.cs.duke.edu/education/courses/spring04/cps004/calendar.htmlVideo Game Package Intro 14Steps to Making a Game1. Extend GameLoop.java–In Constructora. Make Spritesb. Make Trackersc. Attach Trackers to Spritesd. Add Sprites to AnimationCanvas–In advanceFrame provide game logic2. Make a JFrame or Applet3. Add extended GameLoop to JFrame or Applet4. setFrameRate to start the gameLast Edited 1/10/04 CPS4: Java for Video Gameshttp://www.cs.duke.edu/education/courses/spring04/cps004/calendar.htmlVideo Game Package Intro 15Basic Design of theVideo Game PackageAnimationCanvasKeyboardMouseGameLoopJFrameOrAppletTrackerSpriteTrackerSpriteTrackerSprite1. Extend GameLoop.java–In Constructora. Make Spritesb. Make Trackersc. Attach Trackers to Spritesd. Add Sprites to AnimationCanvas–In advanceFrame provide game logic2. Make a JFrame or Applet3. Add extended GameLoop to JFrame or Applet4. setFrameRate to start the gameLast Edited 1/10/04 CPS4: Java for Video Gameshttp://www.cs.duke.edu/education/courses/spring04/cps004/calendar.htmlVideo Game Package Intro 16How Pong was Made1. BallSprite was written to extend Sprite2. WallSprite was written to extend Sprite3. ProjectileTracker was written to implement a Tracker4. PongLoop was written to extend GameLoop5. Pong was written to use PongLoopLast Edited 1/10/04 CPS4: Java for Video Gameshttp://www.cs.duke.edu/education/courses/spring04/cps004/calendar.htmlVideo Game Package Intro 17How Pong was MadeSome of the more complex parts of Pong that we’ll talk about in more detail later:•Loops•Conditionals•Event handling•Inheritance & Interfaces•Collections•Collision detectionLast Edited 1/10/04 CPS4: Java for Video Gameshttp://www.cs.duke.edu/education/courses/spring04/cps004/calendar.htmlVideo Game Package Intro 18How Pong was MadeWhat you will need to know shortly:•Basic classes in the package•Basic structure of the package•Basic steps to making the game•General idea about how Pong.java and PongLoop.java work•Enough familiarity to make minor modifications to BallSprite and PongLoopLast Edited 1/10/04 CPS4: Java for Video Gameshttp://www.cs.duke.edu/education/courses/spring04/cps004/calendar.htmlVideo Game Package Intro 19How Pong was MadeWhat you don’t need to understand yet:•All of the classes in the package•All of the code in the basic classes•How to make your own classes like Pong and PongLoop from scratchLast Edited 1/10/04 CPS4: Java for Video
View Full Document