backgrounds, inheritance in gamemaker (brickmania 1 of 2)

26
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

Upload: lilian

Post on 24-Feb-2016

37 views

Category:

Documents


1 download

DESCRIPTION

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. Upcoming Assignments. Wednesday: Game Concept Document - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Backgrounds, Inheritance in GameMaker (BrickMania 1 of 2)

Backgrounds, Inheritance in GameMaker (BrickMania 1 of 2)

Foundations of Interactive Game DesignProfessor Jim Whitehead

January 28, 2008

Creative Commons Attribution 3.0creativecommons.org/licenses/by/3.0

Page 2: Backgrounds, Inheritance in GameMaker (BrickMania 1 of 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!

Page 3: Backgrounds, Inheritance in GameMaker (BrickMania 1 of 2)

Let’s create a simple Breakout game• Game elements

► Background► Ball► Paddle► Score► Lives► 3 brick types► Playfield is

smaller thanscreen

Page 4: Backgrounds, Inheritance in GameMaker (BrickMania 1 of 2)

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

Page 5: Backgrounds, Inheritance in GameMaker (BrickMania 1 of 2)

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

Page 6: Backgrounds, Inheritance in GameMaker (BrickMania 1 of 2)

Creating a Background

• Resources -> Create Background► Enter name► Can have a

transparent color• Useful for multi-

depth scrolling background

► Load backgroundimage• Select file

Page 7: Backgrounds, Inheritance in GameMaker (BrickMania 1 of 2)

Break Mania Background

• Created usingThe GIMP

► Free software► PC & Mac► Used fills &

text effectsthat comewith GIMP

playfieldscore box

Page 8: Backgrounds, Inheritance in GameMaker (BrickMania 1 of 2)

Create Room• Resources -> Create Room

► Click on “Settings Tab” … enter name of Room

Page 9: Backgrounds, Inheritance in GameMaker (BrickMania 1 of 2)

Add Background to Room• Unselect “Draw background color”• Select

“Visible whenroom starts”

• Use pull-downmenu toselectbackgroundimage

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!

Page 10: Backgrounds, Inheritance in GameMaker (BrickMania 1 of 2)

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

Page 11: Backgrounds, Inheritance in GameMaker (BrickMania 1 of 2)

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

Page 12: Backgrounds, Inheritance in GameMaker (BrickMania 1 of 2)

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

Page 13: Backgrounds, Inheritance in GameMaker (BrickMania 1 of 2)

Making Objects Invisible

• Click on “visible” toggle► If no check, is invisible

Make solid for bounce behavior

Page 14: Backgrounds, Inheritance in GameMaker (BrickMania 1 of 2)

Place Objects in Room• Click on game room, then objects tab• Use pulldown menu to select object to place• Invisible

walls• Bricks• Paddle• Ball

Page 15: Backgrounds, Inheritance in GameMaker (BrickMania 1 of 2)

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

Page 16: Backgrounds, Inheritance in GameMaker (BrickMania 1 of 2)

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

Page 17: Backgrounds, Inheritance in GameMaker (BrickMania 1 of 2)

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

Page 18: Backgrounds, Inheritance in GameMaker (BrickMania 1 of 2)

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

Page 19: Backgrounds, Inheritance in GameMaker (BrickMania 1 of 2)

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.

Page 20: Backgrounds, Inheritance in GameMaker (BrickMania 1 of 2)

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

Page 21: Backgrounds, Inheritance in GameMaker (BrickMania 1 of 2)

Now, set parent of invisible wallsNote no events or actions. It gets these all from its parent, wall-mother!

Set parent to wall-mother using pull-down menu here

Page 22: Backgrounds, Inheritance in GameMaker (BrickMania 1 of 2)

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 collisionbehavior on mother

► Reuse on all bricks• Set each colored brick’s

parent to “brick-mother”

Page 23: Backgrounds, Inheritance in GameMaker (BrickMania 1 of 2)

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 bouncedialog box

Page 24: Backgrounds, Inheritance in GameMaker (BrickMania 1 of 2)

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

Page 25: Backgrounds, Inheritance in GameMaker (BrickMania 1 of 2)

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!

Page 26: Backgrounds, Inheritance in GameMaker (BrickMania 1 of 2)