game maker day 2

23
Game Maker Day 2 Making a Maze Game

Upload: marge

Post on 15-Jan-2016

48 views

Category:

Documents


3 download

DESCRIPTION

Game Maker Day 2. Making a Maze Game. Pop Quiz. Make a Sprite (spr_HeroLeft) using the koala_left.gif image TechInTheWorkplace\assignments\resources\Chapter7\koala_left.gif Make an object (obj_HeroLeft) using the spr_HeroLeft - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Game Maker Day 2

Game MakerDay 2

Making a Maze Game

Page 2: Game Maker Day 2

Pop Quiz• Make a Sprite (spr_HeroLeft) using the

koala_left.gif image– TechInTheWorkplace\assignments\resources\

Chapter7\koala_left.gif

• Make an object (obj_HeroLeft) using the spr_HeroLeft

• Create Events (Up, Down, Left, Right) for obj_HeroLeft so it can move about the screen

• Make a room and add the hero to the room• Demo your room and hero running around

Page 3: Game Maker Day 2

A Little Design

• Sketch a simple maze.

• What objects are needed?

• How do you want them to behave?

Page 4: Game Maker Day 2

Today

• As a class we will…

• Give an overview of a maze

• Create a wall

• Create a goal

• Create a hero that will face the direction it is running

• From there you will create a maze

Page 5: Game Maker Day 2

Maze: The Room

Page 6: Game Maker Day 2

Needed Objects• Hero

– You can load from Game Makers set or– Go to the assignments folder under Resources Walls– Going around the room and in between

• Finish– The hero will reach (collide) this when finished.

• Treasures– Possibly tie to points. (Can look up Score Actions.

Might click the relative box to add points to a score)

• Enemies– An extra.– Maybe add weapons for getting rid of enemies

Page 7: Game Maker Day 2

Behavior• Walls

– Solid• Hero

– Move with pressed keys. Left, right, up, down and stop.– When it hits (Collides with) a wall, it stops– Extra

• Gather treasure and get points, run into enemy and lose points, finish the maze and win

• When key pressed, shoot.• Finish

– Solid• Extras

– Treasures• Disappear when Hero runs into you.

– Enemies• When shot, disappear and add points to the total• Move towards the Hero and around the walls

Page 8: Game Maker Day 2

Start by gathering sprites

• Hero– Person, animal, …– Load sprites for each direction. Up, down, left, right,

stop• Wall

– Brick• Finish

– You pick• Extra

– Treasure– Enemy

I have added sprites to the Assignments

folder under Resources. There are

Koala sprites in chapter7. I’ll use the Koala in my example

Page 9: Game Maker Day 2

Getting and Fitting SpriteClick on the

pacmanClick on Load Sprite

and pick a sprite

Notice the Width and

Height are both 40. It is best to have the sizes as multiples of 2. So we will change this to 32. To do this,

click on Edit Sprite

Select Transform -> Stretch Images

Change the Width and Height pixels

to 32.

Click OK

Click the Green Check

Click OK

Load the following sprites:Hero: Left, Right, Up, Down, Stop

WallFinish

Page 10: Game Maker Day 2

Giving Direction Pictures

• For this example I’ll use different sprites for right, up, down and stop.

• When the Hero object is created we will make it use the correct sprite depending on the direction it is traveling.

Page 11: Game Maker Day 2

Making the Wall: Again Stretch it to 32 x 32Click on the

pacmanClick on Load Sprite

and pick a sprite

Notice the Width and

Height are both 40. It is best to have the sizes as multiples of 2. So we will change this to 32. To do this,

click on Edit Sprite

Select Transform -> Stretch Images

Change the Width and Height pixels

to 32.

Click OK

Click the Green Check

Click OK

Page 12: Game Maker Day 2

Now the FinishClick on the

pacman

Click on Load Sprite

and pick a sprite

Notice the Width and

Height are both 40. It is best to have the sizes as multiples of 2. So we will change this to 32. To do this,

click on Edit Sprite

Select Transform -> Stretch Images

Change the Width and Height pixels

to 32.

Click OK

Click the Green Check

Click OK

Page 13: Game Maker Day 2

So far

• Created sprites for the following– Hero– Wall– Finish

• Now it’s time to make the objects

Page 14: Game Maker Day 2

Wall ObjectClick ‘Create and

Object’ button

Name the objectobj_wall

Use the pull down menu and select

spr_wall

Make the object solid.

No Events???The wall will just sit there, so it does not need any

events.

Page 15: Game Maker Day 2

Goal ObjectClick ‘Create and

Object’ button

Name the objectobj_goal

Use the pull down menu and select

spr_exit

No Events???The goal/exit will just sit there, so it also does not need

any events.

Page 16: Game Maker Day 2

Hero Object

• Behaviors• Hit left arrow, point left and go left• Hit right arrow, point right and go right.• Hit down arrow, point down and go down• Hit up arrow, point up and go up• No key hit, point stop and go stop• Hit a wall, point stop and go stop• Hit the goal, Say you win, end the game.• We’ll start with coding the left arrow

Page 17: Game Maker Day 2

Hero Object and Point Left when moving left

Click on Create Object

Name itobj_hero

Select a sprite:Pick

spr_heroRightThis will be the

starting direction of the Hero

Add Event

Click on Keyboard

Select main1

tab

Drag Change Sprite into the Actions window

Click on the menu and select the left

facing sprite. spr_heroLeft

OK

Select <Left>

Page 18: Game Maker Day 2

Go LeftSelect the move tabDrag the Move

Fixed icon into the Actions window

Select the left arrow

Give it a speed of 5

Click OK

Page 19: Game Maker Day 2

Other Key-pressed Events

• Left

• Right

• Up

• Down

• Stop (‘No key’ being pressed, or ‘Any Key’ begin released)

Page 20: Game Maker Day 2

Hit the wall

Add Event

Click on Collision

Pull down to obj_wall

Page 21: Game Maker Day 2

Change to the stop sprite

Main1 tabDrag the change

sprite to the event window

Select the stop sprite

Page 22: Game Maker Day 2

Stop the Hero

Select the move tab

Drag the Move Fixed icon into the Actions window

Click on the no direction

button

OK

Page 23: Game Maker Day 2

Keep going

• Now you have the beginning tools to

• Create a maze (Using the walls)

• Create a goal

• Create a hero

• Now continue to work on the maze.