Presentation is loading. Please wait.

Presentation is loading. Please wait.

Video Game Package Intro 1 Last Edited 1/10/04CPS4: Java for Video Games Introduction.

Similar presentations


Presentation on theme: "Video Game Package Intro 1 Last Edited 1/10/04CPS4: Java for Video Games Introduction."— Presentation transcript:

1 Video Game Package Intro 1 Last Edited 1/10/04CPS4: Java for Video Games http://www.cs.duke.edu/education/courses/spring04/cps004/calendar.html Introduction to Jam’s Video Game Package

2 Video Game Package Intro 2 Last Edited 1/10/04CPS4: Java for Video Games http://www.cs.duke.edu/education/courses/spring04/cps004/calendar.html The 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 Package

3 Video Game Package Intro 3 Last Edited 1/10/04CPS4: Java for Video Games http://www.cs.duke.edu/education/courses/spring04/cps004/calendar.html Scope 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 games

4 Video Game Package Intro 4 Last Edited 1/10/04CPS4: Java for Video Games http://www.cs.duke.edu/education/courses/spring04/cps004/calendar.html Basic Design of the Video Game Package Animation Canvas Keyboard Mouse GameLoop JFrame Or Applet Tracker Sprite Tracker Sprite Tracker Sprite

5 Video Game Package Intro 5 Last Edited 1/10/04CPS4: Java for Video Games http://www.cs.duke.edu/education/courses/spring04/cps004/calendar.html Basic Design of the Video Game Package Tracker The Tracker is what Makes the BallSprite move

6 Video Game Package Intro 6 Last Edited 1/10/04CPS4: Java for Video Games http://www.cs.duke.edu/education/courses/spring04/cps004/calendar.html Basic Design of the Video Game Package Point2D.Double getLocation() double getScaleFactor() double getRotationAddition() void advanceTime() Tracker

7 Video Game Package Intro 7 Last Edited 1/10/04CPS4: Java for Video Games http://www.cs.duke.edu/education/courses/spring04/cps004/calendar.html Basic Design of the Video Game Package Tracker Sprite

8 Video Game Package Intro 8 Last Edited 1/10/04CPS4: Java for Video Games http://www.cs.duke.edu/education/courses/spring04/cps004/calendar.html Basic Design of the Video Game Package Has instance variables, and mutator and accessor methods for: Shape Location Size Rotation Color Tracker Sprite

9 Video Game Package Intro 9 Last Edited 1/10/04CPS4: Java for Video Games http://www.cs.duke.edu/education/courses/spring04/cps004/calendar.html Basic Design of the Video Game Package Animation Canvas Tracker Sprite Tracker Sprite Tracker Sprite

10 Video Game Package Intro 10 Last Edited 1/10/04CPS4: Java for Video Games http://www.cs.duke.edu/education/courses/spring04/cps004/calendar.html Basic Design of the Video Game Package AnimationCanvas is a JPanel with a collection of Sprites that paints itself by painting all of its Sprites Animation Canvas Tracker Sprite Tracker Sprite Tracker Sprite

11 Video Game Package Intro 11 Last Edited 1/10/04CPS4: Java for Video Games http://www.cs.duke.edu/education/courses/spring04/cps004/calendar.html Basic Design of the Video Game Package GameLoop adds: animation interaction via –Keyboard –Mouse Keyboard Mouse GameLoop Animation Canvas Tracker Sprite Tracker Sprite Tracker Sprite

12 Video Game Package Intro 12 Last Edited 1/10/04CPS4: Java for Video Games http://www.cs.duke.edu/education/courses/spring04/cps004/calendar.html Basic Design of the Video Game Package JFrame or Applet used to: Put the game on the screen Start the game Provide game control JFrame Or Applet

13 Video Game Package Intro 13 Last Edited 1/10/04CPS4: Java for Video Games http://www.cs.duke.edu/education/courses/spring04/cps004/calendar.html Basic Design of the Video Game Package Animation Canvas Keyboard Mouse GameLoop JFrame Or Applet Tracker Sprite Tracker Sprite Tracker Sprite

14 Video Game Package Intro 14 Last Edited 1/10/04CPS4: Java for Video Games http://www.cs.duke.edu/education/courses/spring04/cps004/calendar.html Steps to Making a Game 1.Extend GameLoop.java –In Constructor a.Make Sprites b.Make Trackers c.Attach Trackers to Sprites d.Add Sprites to AnimationCanvas –In advanceFrame provide game logic 2.Make a JFrame or Applet 3.Add extended GameLoop to JFrame or Applet 4.setFrameRate to start the game

15 Video Game Package Intro 15 Last Edited 1/10/04CPS4: Java for Video Games http://www.cs.duke.edu/education/courses/spring04/cps004/calendar.html Basic Design of the Video Game Package Animation Canvas Keyboard Mouse GameLoop JFrame Or Applet Tracker Sprite Tracker Sprite Tracker Sprite 1.Extend GameLoop.java –In Constructor a.Make Sprites b.Make Trackers c.Attach Trackers to Sprites d.Add Sprites to AnimationCanvas –In advanceFrame provide game logic 2.Make a JFrame or Applet 3.Add extended GameLoop to JFrame or Applet 4.setFrameRate to start the game

16 Video Game Package Intro 16 Last Edited 1/10/04CPS4: Java for Video Games http://www.cs.duke.edu/education/courses/spring04/cps004/calendar.html How Pong was Made 1.BallSprite was written to extend Sprite 2.WallSprite was written to extend Sprite 3.ProjectileTracker was written to implement a Tracker 4.PongLoop was written to extend GameLoop 5.Pong was written to use PongLoop

17 Video Game Package Intro 17 Last Edited 1/10/04CPS4: Java for Video Games http://www.cs.duke.edu/education/courses/spring04/cps004/calendar.html How Pong was Made Some of the more complex parts of Pong that we’ll talk about in more detail later: Loops Conditionals Event handling Inheritance & Interfaces Collections Collision detection

18 Video Game Package Intro 18 Last Edited 1/10/04CPS4: Java for Video Games http://www.cs.duke.edu/education/courses/spring04/cps004/calendar.html How Pong was Made What 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 PongLoop

19 Video Game Package Intro 19 Last Edited 1/10/04CPS4: Java for Video Games http://www.cs.duke.edu/education/courses/spring04/cps004/calendar.html How Pong was Made What 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 scratch

20 Video Game Package Intro 20 Last Edited 1/10/04CPS4: Java for Video Games http://www.cs.duke.edu/education/courses/spring04/cps004/calendar.html How Pong was Made What you’ll be doing in the next homework: (in addition to problems from Big Java) Altering BallSprite Altering ProjectileTracker …and it will be fun (when it works)

21 Video Game Package Intro 21 Last Edited 1/10/04CPS4: Java for Video Games http://www.cs.duke.edu/education/courses/spring04/cps004/calendar.html How Pong was Made Let’s take a look at two classes: 1.Open up a web browser 2.Go to the course website and download pong.jar to the desktop (from code link) 3.Open up Eclipse 4.Import pong.jar 5.Look in tipgame for BallSprite.java 6.Look in tipgame for ProjectileTracker.java


Download ppt "Video Game Package Intro 1 Last Edited 1/10/04CPS4: Java for Video Games Introduction."

Similar presentations


Ads by Google