110 likes | 216 Views
Developing a Simple Game-Themed Application. Goals. Design and implement a simple “game” Practice what we have learned so far Separation of logic and graphical interaction Let’s work in groups (3 or 4) …. Approach. Goal: A detailed design for implementation in 3 hours
E N D
Goals • Design and implement a simple “game” • Practice what we have learned so far • Separation of logic and graphical interaction • Let’s work in groups (3 or 4) …
Approach • Goal: • A detailed design for implementation in 3 hours • Tasks: (in 90 minutes) • 20 min: Game idea (be SIMPLE! ) • 10 min: Relative sizes and look (coordinate system) • 10 min: Main object look/behavior (class) • 10 min: Support object look/behavior (class) • 20 min: User and Object interaction (in UpdateWorld)
Game Idea • Logic vs Interactive Graphics • Today: concentrate on Interactive Graphics • Avoid in-game “AI” (or smart game) • E.g.: tricky to implement: • User control Object A • Game controls Object B to follows automatically • E.g.: Easy to implement • Use control Object A • Game controls Object B _RANDOMLY_ • Test for Object A and B interesection
Choose A ‘Game’ Type • Graphical Picture • Nothing moves • No user interaction • Animation / Visualization • A sequence of pre-defined movements • No user interaction • Interactive Game • Movement of objects responds to user interaction
‘Game’ Type Examples • Graphical picture: • Response to simple user commands (e.g., draw a picture responding to a button push) • Draw a histogram • Animation / visualization / simulation: • Dropping a ball: conditions ensuring the ball bounces when it reaches the ground, implement a mathematical equation • Visualization of random samples • Interactive • Initial object setup • One/multiple objects under user control • Update and test for object intersection in UpdateWorld
Finding Ideas For ‘Game’ Type • Card Games • Board Games: • Snakes and Ladders • Reversi • Anything you’ve found fun (or not) • Breaking Bubbles • Alphabet Hero
Designing A Game • Draw pictures/ideas • Play the “game” on paper during design. • Remember, complicated in-game AI is tricky to implement!
Implementation Guide • 4 major pieces to implementation: • The World • Hero Object • Support Object • Interaction between objects
The World • Relative size: • Window size vs. Object size • Continuous Coordinate • E.g., The BlockBreak Game • Discrete Coordinate • E.g., Reversi (position (1.5,1.5) is illegal) • In InitializeWorld()!!
The Hero/Support Object • Look: Constructor() • Size, color, texture • Behavior: Update() • User control behavior (e.g., user move paddle) • Automatic behavior (e.g., gradually slow down when user is not moving) • Automatic behavior is trickier to implement! • Interaction: Interact() • Interaction with other (Support) objects • Called from UpdateWorld()