Jan282010

Jan282010 - UC Santa Cruz Computer Science Game Design...

Info iconThis preview shows pages 1–8. Sign up to view the full content.

View Full Document Right Arrow Icon
Computer Science – Game Design UC Santa Cruz 11/10/10 Announcements Website Readings and sample code updated Last year’s mid-term exam with answer key Mid-term exam date
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Computer Science – Game Design UC Santa Cruz 11/10/10 Problem: Adding exhaust, shield to spaceship Vertically scrolling 2D space shooters have a spaceship that: Banks left or right, depending on motion Typically have three animations: Banking left, straight ahead, banking right Also want to Add particle effect for exhaust if the ship is moving up the screen But turn this off if it’s moving down the screen Add a shield in front of the ship if the player picks up a shield powerup Could accomplish all of these visuals using a series of combined animations Bank left, bank left and shield, bank left and Ikaruga, Treasure
Background image of page 2
Computer Science – Game Design UC Santa Cruz 11/10/10 Decorating the spaceship with shield & exhaust Instead of pre-defining all possible animations… Draw the shield, exhaust, and spaceship separately Can think of “decorating” the spaceship with a shield, or an exhaust particle effect, as needed Some powerup options in Gratuitous picture of a Vic Viper model
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Computer Science – Game Design UC Santa Cruz 11/10/10 Decorators using object- Basic idea is to create a linked list of objects Each object draws one part of final scene… E.g., the exhaust, the shield, etc. spaceship spaceship shield shield exhaust Exhaust, shield, and spaceship are object instances
Background image of page 4
Computer Science – Game Design UC Santa Cruz 11/10/10 Decorator pattern IComponent interface gives just the decoration Operation() Can mix in this Interface with a wide range of classes Component is terminal element (spaceship) Decorator provides decorating elements (shield, exhaust) Diamond-headed arrow indicates that Decorator instances have a reference to an instance of IComponent (another Decorator, or a
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Computer Science – Game Design UC Santa Cruz 11/10/10 Essence of the Decorator The essence of the Decorator pattern Linked list of object instances, first one calls next one, etc. Each object adds its particular computation (often, but not exclusively, visual) to the output before passing to next object It is possible to have multiple chains, each ending at the same terminal (or
Background image of page 6
Computer Science – Game Design UC Santa Cruz 11/10/10 Implementation details Need to know next object in chain Typically passed into the constructor Could have a separate method instead (would need to add this to IComponent May need to know details about terminal object Need to know position of spaceship to put shield directly
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 8
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 11/10/2010 for the course CMPS 101 taught by Professor Tantalo,p during the Fall '08 term at UCSC.

Page1 / 27

Jan282010 - UC Santa Cruz Computer Science Game Design...

This preview shows document pages 1 - 8. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online