Presentation is loading. Please wait.

Presentation is loading. Please wait.

Backgrounds, Inheritance in GameMaker (BrickMania 1 of 2) Foundations of Interactive Game Design Professor Jim Whitehead January 28, 2008 Creative Commons.

Similar presentations


Presentation on theme: "Backgrounds, Inheritance in GameMaker (BrickMania 1 of 2) Foundations of Interactive Game Design Professor Jim Whitehead January 28, 2008 Creative Commons."— Presentation transcript:

1 Backgrounds, Inheritance in GameMaker (BrickMania 1 of 2) Foundations of Interactive Game Design Professor Jim Whitehead January 28, 2008 Creative Commons Attribution 3.0 creativecommons.org/licenses/by/3.0

2 Upcoming Assignments Wednesday: Game Concept Document ► A compelling document that sells your game concept ► Title page Title of game, name of group, name of team members, sample artwork ► Overview page Table at top: game genre, platform (PC/GameMaker, PC/RPG Maker, etc.), team size Key points section –Bulleted list of important elements of gameplay –Goal of game, what makes game unique, main characters, main fictional elements –Sample artwork image to give feel of the game ► Biographies True, pocket biographies of each team member (1-2 paragraphs each) stressing experience that makes you a strong game designer ► 1-3 pages giving a textual description of the game Fictional background, brief description of characters, goal of player in game, how does player interact with the game, brief description of levels, game audience, other important elements as needed. ► 1-2 pages of sample conceptual artwork Hand-drawn sketches are fine Start early!

3 Let’s create a simple Breakout game Game elements ► Background ► Ball ► Paddle ► Score ► Lives ► 3 brick types ► Playfield is smaller than screen

4 Backgrounds Background ► Represents a static background image ► Defined separately, then combined with a room ► Can move, or be motionless Many uses ► Moving starfield Create starfield bitmap image Define as background Have it move backwards: creates sensation of motion ► Image surrounding playfield of game BreakMania uses a background this way

5 Detecting edges of background Reduce boundary objects ► In tile-based games, need many tiles to create an interesting level ► With objects, would need separate object for each tile type Can slow a game down ► Instead, create background image ► Then, use single, invisible boundary object for collision detection Can be easier to create background in drawing program ► Then, just use simple shapes for collision detection ► May be easier than converting to tiles at times

6 Creating a Background Resources -> Create Background ► Enter name ► Can have a transparent color Useful for multi- depth scrolling background ► Load background image Select file

7 Break Mania Background Created using The GIMP ► Free software ► PC & Mac ► Used fills & text effects that come with GIMP playfield score box

8 Create Room Resources -> Create Room ► Click on “Settings Tab” … enter name of Room

9 Add Background to Room Unselect “Draw background color” Select “Visible when room starts” Use pull-down menu to select background image Select grid size to match size of sprites – for us, 10x10 works well Note grid alignment with background image boundaries – need to plan ahead for this!

10 Create Sprites For BreakMania need sprites for: ► Paddle ► Ball ► Three brick types ► Small paddle (for lives display) ► Three different wall types Two different vertical (10x50,10x30), & one horizontal (10x50) Used to create invisible barrier for edge of playfield ► Game over text

11 Create Objects For most of the sprites, need to create an associated object ► Resources -> Create Object ► Solid: Paddle, three brick objects, three wall objects ► Not solid: Ball, game over ► No need to create small paddle object ► Only need to use the sprite for lives display For now, no behavior ► Will add soon

12 Create Invisible Objects Three wall types all must be invisible ► Will place them over the background ► Ball will collide with invisible wall objects ► To player, will seem like collision with background Wall objects placed at edge of black playfield. Show with dotted lines to represent being invisible during gameplay

13 Making Objects Invisible Click on “visible” toggle ► If no check, is invisible Make solid for bounce behavior

14 Place Objects in Room Click on game room, then objects tab Use pulldown menu to select object to place Invisible walls Bricks Paddle Ball

15 Ball Behavior When ball is created, want it to start moving upwards at an angle Use create event on ball ► Start moving in direction ► Click two up diagonal arrows ► Speed of 10

16 Paddle Behavior - Movement Left arrow moves left, right arrow moves right Up/down arrows stop Use keypress events for these

17 Paddle Behavior – Ball Collision Ball should bounce after hitting paddle Pick collision event, then select ball from pull-down menu that appears Drag-n-drop bounce to actions

18 Wall Behavior If paddle collides with wall, paddle stops If ball collides with wall, want it to bounce Could define this separately on all three wall types ► Tedious ► Error-prone, since every change needs to be copied over to the other two walls ► Would be nice if this could be stated once, for all walls Use object inheritance

19 Inheritance Objects can have a parent ► All of the behaviors of the parent are copied to its children ► Imagine a “wall-mother” object A collision event with the ball causes the ball to bounce ► Now, make all three invisible walls have wall-mother as a parent All invisible walls now collide with the ball like the mother! By defining one wall-mother object, avoids cut-and-paste of collision behavior to three invisible walls. ► Note that it is possible to change inherited behavior on children Just define the specific event a different way. Child’s definition always trumps that of the parent.

20 Creating Wall-Mother No sprite, since we’re using this just for behavior. Leave it to children to specify exact visual shape. Don’t set visible, do set solid, since that’s what children should be. Visible doesn’t matter for wall-mother, since it has no sprite Make ball bounce off walls

21 Now, set parent of invisible walls Note no events or actions. It gets these all from its parent, wall-mother! Set parent to wall- mother using pull- down menu here

22 Brick behavior If a ball hits a brick: ► It should disappear ► Small ring effect ► Play sound ► Ball should bounce ► Score should go up Three brick types Use inheritance from new brick-mother ► Put collision behavior on mother ► Reuse on all bricks Set each colored brick’s parent to “brick-mother”

23 Ball Bouncing Off Brick The collision of brick with ball is on brick-mother ► But, we want the ball to bounce, not the brick ► How to do this? ► Each collision is between two objects: The object hosting the collision event The “other” object In this case, the brick is hosting the collision, the ball is the “other” ► To indicate ball should bounce, select “other” in bounce dialog box

24 Making Brick Disappear Each brick on screen is an instance of a brick object Can think of the object as a kind of “mold” that can stamp out many different instances of the object Brick object: mold :: individual bricks: instances To make brick disappear: ► Destroy the instance ► On tab main1

25 Creating Brick Ring Effect On draw tab, select “Create Effect” button Add offset so ring emerges from center of the brick Click relative so ring emerges from brick, not upper left corner of screen!

26


Download ppt "Backgrounds, Inheritance in GameMaker (BrickMania 1 of 2) Foundations of Interactive Game Design Professor Jim Whitehead January 28, 2008 Creative Commons."

Similar presentations


Ads by Google