Game maker tutorial
Download
1 / 52

Game Maker Tutorial - PowerPoint PPT Presentation


  • 285 Views
  • Uploaded on

Game Maker Tutorial. Where to Get. Game Maker Tutorials http://ictmindtools.net/gamemaker/tutorials/ Introduction Clickball Where is it? Shooting Maze Game Monsters Maze Game 2 Scoring & Lives Sprites Platform Moves Jumping Ladders Backgrounds Variables Programming Challenges

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about ' Game Maker Tutorial' - hieu


An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript

Where to get
Where to Get..

  • Game Maker Tutorials

    • http://ictmindtools.net/gamemaker/tutorials/

      • IntroductionClickball

      • Where is it?Shooting

      • Maze GameMonstersMaze Game 2

      • Scoring & LivesSpritesPlatform MovesJumping

      • LaddersBackgroundsVariables

      • ProgrammingChallenges

  • Game Maker 8.1 Download

    • http://www.yoyogames.com/


Introduction

User Interface

rooms: the scenes (levels) in which the objects live

backgrounds: the images used as background for the rooms

objects: the things in the game

instances: one particular occurrence of an object

sprites: images that are used to show the objects

sounds: these can be used in games, either as background music or as effects

scripts: small pieces of code that can be used to extend the possibilities of your game

Introduction


Your first game
Your First Game

  • Step 1: Set up the Game area

    • Start Game Maker and create a room where the action will happen:

    • Click the 'Add Room' icon

    • Choose a background colour

    • In settings, make the room caption 'Catch the Ball'


Your first game1
Your First Game

  • Step 2: Add in the Sprites you need - a ball and a wall

    • Click the 'Add Sprite' icon

      • Name it sprBall

    • Click Load Sprite, and find the ball image.

    • We also need a wall sprite.

      • Find it in the Pacman folder.

      • Name it sprWall

  • Naming Sprites, Sounds & Objects

    • every sprite  sprXXXX

    • the sounds  sndXXXX

    • the objects  objXXXX.


Your first game2
Your First Game

  • Step 3: Create the objects

    • create ball and wall objects

      • need an object to put in your game. 

      • A sprite just represents the object.

    • Click the Add Object icon

      • Name it objBall

      • Choose the Ball sprite to represent the object

        • don't make it solid. (It's best not to make moving objects solid.)

        • It interferes with the Game Maker collision detection system and your object may become 'stuck'

    • Add in a wall object. 

      • Name it objWall, choose the Wall sprite, and make it solid.


Your first game3
Your First Game

  • Step 4: add them to the room

    • Put it in the room and add a wall

    • Open the room

      • Add in a ball (left click)

        • Delete (right click)

      • Add in walls (hold Shift and click)

        • Copy Multiple Object (Shift + Left click)

        • Move Object (Ctrl + Left Click)


Your first game4
Your First Game

  • Step 5: Set up the Events for when your game is played

    • Events are the things that happen in your game.

    • We want the ball to start moving in a random direction.

    • Open the properties for the ball object

    • Add in an Event for when the ball is created.

    • Choose start moving in all directions at speed 8

      • the ball moves 8 pixels for each step of the game. 

      • If the game is running at the normal speed of 30 frames per second, then there will be 30 steps every second. 

        • You can change the game speed in the settings tab of the room properties    


Your first game5
Your First Game

  • Step 6: set a bounce action for when the ball collides with the wall.

    • Add in an event for when the ball collides with the wall.

    • Set the ball to bounce.

  • Step 7: add score

    • Add in an event to the ball object for when the left mouse button is pressed.

      • Set the score to 1, but make sure you choose Relative.

    • Left Button vs Left Press ??

    • Relative vs Absolute ??


Your first game6
Your First Game

  • Step 8: add alarm

    • Approx every second we will make the ball change direction. 

    • setting an alarm clock to trigger an event every second.

      • set the alarm clock when the game first starts,

      • each time the alarm goes we will make the ball change direction

      • reset the alarm.


Your first game7
Your First Game

  • Step 9: add sounds

    • set a sound(sndBeef1) for when the ball collides with the wall.

    • set a sound(sndGunshot1) to the ball object for when the left mouse button is pressed.

      • Create beef1 and gunshot1 sounds

      • the collision event with the wall

        • Play sndBeef1

      • the left button press event

        • Play sndGunshot1


Your first game8
Your First Game

  • Step 10: setting a background

    • improve the appearance by setting a background.

  • Step 11: add information

    • add information to tell the user how to play the game


Your first game9
Your First Game

  • Step 12: Ending your Game

    • Let's say we want the game to end when the player's score is 20.

      • Each time we add to the score, we will check whether the score is equal to 20 Ending the Game more Gracefully

  • Extension

    • improve the Ending Game by creating a text object and putting it in an ending room


Your first game10
Your First Game

  • Extension

    • Making your Ball Bounce Accurately off Walls

      • you need to treat horizontal and vertical walls separately. 

        • Create sprites and objects for a ball, a horizontal wall block and a vertical wall block.

      • Add a room and draw a box around the ball using the sprites.

      • start the ball moving in a random direction and set events to make the ball bounce


Official tutorial
Official Tutorial

  • Official Tutorial

    • Tutorial: What is a Good Game? (zip file, 190 KB)

    • Tutorial: Your First Game (zip file, 850 KB)

    • Tutorial: Creating a Scrolling Shooter (zip file, 1.8 MB)

    • Tutorial: Maze Games (zip file, 1.4 MB)

    • Tutorial: Platform Games (zip file, 1.6 MB)

    • Tutorial: 3-Dimensional Games (zip file, 1.1 MB)

    • Tutorial: Multiplayer Games (zip file, 210 KB)

    • Tutorial: A First Person Shooter (zip file, 2.4 MB)


A scrolling shooter
A Scrolling Shooter

  • Variables and properties

    • Properties/variables that each instance

      • x  x-coordinate of the instance

      • y  y-coordinate of the instance

      • hspeed  horizontal speed (in pixels per step)

      • vspeed  vertical speed (in pixels per step)

      • direction  current direction of motion in degrees

        • 0-360: 0 is horizontally to the right

      • speed  current speed in this direction

      • visible  whether the object is visible (1) or invisible (0)

      • solid  whether the object is solid (1) or not solid (0)


A scrolling shooter1
A Scrolling Shooter

  • Variables and properties

    • global variables:

      • score  current value of the score

      • lives  current number of lives

      • mouse_x  x-position of the mouse

      • mouse_y  y-position of the mouse

      • room_speed  current speed of the room (in steps per second)

      • room_caption  caption shown in the window title

      • room_width  width of the room in pixels

      • room_height  height of the room in pixels


A scrolling shooter2
A Scrolling Shooter

  • Game Maker Variable

    • in the Control tab:

      • Set the value of a variable

      • If a variable has a value

  • A Scrolling Shooter : 1945


A scrolling shooter3
A Scrolling Shooter

  • The illusion of motion

    • background image  back_water

      • set the Vert. speed to 2.


A scrolling shooter4
A Scrolling Shooter

  • The illusion of motion

    • create three sprites with the images

      • island1.png, island2.png, island3.png  spr_islandX

      • uncheck the box Precise collision checking

    • create objects with three sprites

      • spr_islandX  obj_islandX

      • Uncheck solid

      • Depth : 10000

        • The instances with highest

          depth are drawn first


A scrolling shooter5
A Scrolling Shooter

  • The illusion of motion

    • Add Event to obj_islandX

      • Create : Set the vertical speed  2

      • Step

–65 for the y-position to make sure the island starts completely above the room.


A scrolling shooter6
A Scrolling Shooter

  • The main plane

    • create spr_myplane with myplane_strip3.png

      • in files that end with _stripXX

        • XX indicates the number of subimages.

      • check the box Precise collision checking

    • create obj_myplane

      • spr_myplane  obj_myplane

      • Uncheck solid

      • Depth : -100


A scrolling shooter7
A Scrolling Shooter

  • The main plane

    • Add Event to obj_myplane

      • Add keyboard event

        • <Left> : if (x > 40)  (-4,0)

        • <Right> : if (x< room-width-40)  (4,0)

        • <Up>: If (y > 40)  (0,-2)

        • <Down> : If (y<room_height-120)  (0, 2)

Don't forget to check the box labeled Relative

positive y-direction is downwards

Origin : (0,0)


A scrolling shooter8
A Scrolling Shooter

  • Enemy and weapon

    • create spr_bullet with bullet.png

    • create obj_bullet ( spr_bullet)

    • Add Event

      • Create : Set Vertical Speed  -8

      • Step


A scrolling shooter9
A Scrolling Shooter

  • Enemy and weapon

    • Add Event to obj_myplane

      • Create :

      • Alarm 0 :

      • <Space>

        • Test Variable

          • can_shoot equal to 1

        • Start of a block

          • Create instance

            (0, -16) , relative

          • Set Variable

            can_shoot  0

          • Set Alarm 0

            Number of Step  15

        • End of a block


A scrolling shooter10
A Scrolling Shooter

  • Enemy and weapon

    • Add sound

      • snd_explosion1.wav

      • snd_explosion2.wav

    • Add Sprite & Object Explosion

      • spr_explosionX  obj_explosionX

      • Add Event : obj_Explosion1

      • Add Event : obj_Explosion2


A scrolling shooter11
A Scrolling Shooter

  • Enemy and weapon (make the first enemy)

  • create spr_enermy1 with enermy1_strip3.png

  • create obj_enenrmy1 ( spr_enenmy1)

    • Depth  0

  • Add Events

    • Create

      • Create : Set Vertical Speed  4

    • Step


A scrolling shooter12
A Scrolling Shooter

  • Enemy and weapon (make the first enemy)

    • Collision : obj_myplane

    • Collision : obj_bullet


A scrolling shooter13
A Scrolling Shooter

  • Add Object

    • Create object : controller_enemy

      • Uncheck  visible

    • Add Event

      • Create

      • Alarm 0

    • Add object to room


A scrolling shooter14
A Scrolling Shooter

  • Scores, lives, and damage

    • Create snd_background with background.mid

    • Create spr_bottom with bottom.png

    • Create spr_life with life.png

    • Create object : control_life

    • Add Events

      • Create


A scrolling shooter15
A Scrolling Shooter

  • Scores, lives, and damage

    • Add Events

      • No More Lives

      • No More Health



A scrolling shooter17
A Scrolling Shooter

  • Scores, lives, and damage

    • Change Events in obj_enemy1

      • Collision : obj_myplane


A scrolling shooter18
A Scrolling Shooter

  • Scores, lives, and damage

    • Change Events in obj_explosion2


A scrolling shooter19
A Scrolling Shooter

  • More enemies

    • create spr_enermy2 with enermy2_strip3.png

    • create obj_enermy2 ( spr_enermy2) Depth  0

    • Add Event

      • Create : Set the vertical speed 4

      • Step

        • Create instance

          • obj_enermybullet1 (0,16)

      • Collision : obj_myplane

      • Collision : obj_bullet


A scrolling shooter20
A Scrolling Shooter

  • More enemies

    • create spr_enermy3 with enermy3_strip3.png

    • create obj_enermy3 ( spr_enermy3) Depth  0

    • Add Event

      • Create : Set the vertical speed 4

      • Step

        • Create instance

          • obj_enermybullet2 (0,16)

      • Collision : obj_myplane

      • Collision : obj_bullet


A scrolling shooter21
A Scrolling Shooter

  • More enemies

    • create spr_enermy4 with enermy4_strip3.png

    • create obj_enermy4 ( spr_enermy4) Depth  0

    • Add Event

      • Create : Set the vertical speed -4

      • Step

      • Collision : obj_myplane

      • Collision : obj_bullet


A scrolling shooter22
A Scrolling Shooter

  • More enemies

    • Create snd _explosion3 with explosion1.wav

    • Create spr_enermybullet1 with enermybullet1.png

    • Create obj_enermybullet1 ( spr_enermybullet1) Depth  0

    • Add Event

      • Create : Set the vertical speed 8

      • Collision : obj_myplane

      • Outside Room

        • Destroy the instance


A scrolling shooter23
A Scrolling Shooter

  • More enemies

    • Create spr_enermybullet2 with enermybullet2.png

    • Create obj_enermybullet2 ( spr_enermybullet2) Depth  0

    • Add Event

      • Create

      • Collision : obj_myplane

      • Outside Room

        • Destroy the instance


A scrolling shooter24
A Scrolling Shooter

  • More enemies

    • Change Events : controller_enermy

      • Create

      • Alarm 0


A scrolling shooter25
A Scrolling Shooter

  • More enemies

    • Change Events : controller_enermy

      • Alarm 1

      • Alarm 2

      • Alarm 3

5

3


Maze game
Maze Game

  • Add 2 rooms : Set the room size to be 480x480 pixels and set the grid to be 32x32 pixels

  • adding 3 sprite

    • sprWall sprPerson sprTarget

  • Create objects

    • Now create a wall object: Name it objWall

      • Use the wall sprite

      • Make it solid (so things can't pass through it)

    • Create the person object : Name it objPerson

      • Use the person sprite

    • Create a target object : Name it objTarget

      • The target object should not be solid, as the player needs to be able to move on top of it.  When the player collides with the target object, the game will continue on to the next room.


Maze game1
Maze Game

  • Set up movement for the person

    • Add an event to the person object for the Keyboard  <Left>

      • Add the action from the Control tab 'If instance is aligned with grid‘

      • Set the snap horizontal and snap vertical to be 32 pixels.

      • Add a start moving in direction

      • Set the direction to be left and speed to be 4

    • Add actions for the up, down and right keys.  (You can use the duplicate event option to make this job easier)

    • To stop the person moving

      • add actions for the <No Key> event

      • Click the centre block in the 'Start moving in a direction' options.


Maze game2
Maze Game

  • Set up collision handling

    • If the person collides with a wall it should stop, so add a collision event

    • Add a collision event to the target object for a collision with objPerson


Maze game3
Maze Game

  • Draw 2 maze-like rooms

    • making sure that you have walls all around the outside. 

    • Place the person and target at the beginning and end of your maze


Monsters
Monsters

  • Add in 2 sprites

    • one facing left and the other facing right

    • objMonsterleft, bjMonsterRight

    • Make a monster object : objMonster

  • Add a create event for objMonster

    • Add in a Start Moving action

    • make it start moving to the right.

  • Add a collision event for objMonster

    • add in the following actions:

Paths are another way of doing the same thing, but without using collisions with blocks to turn the monster around.


Maze game 2
Maze Game 2

  • To make the maze more interesting, we should be collecting diamonds along the way. 

    • A door stops the person from getting to the target.  When all the diamonds are gone, the door disappears.

    • The target does not appear in the room until all the diamonds are collected. 

  • Add 2 new sprites

    • sprDoor and sprDiamond 

  • Add 2 new objects

    • objDoor and objDiamond. 

    • Make the door solid as it acts like a wall


Maze game 21
Maze Game 2

  • Add sounds

    • for picking up the diamonds : sndDiamond

    • for opening the door : sndDoor.

  • Place diamonds around your maze.

    • The objDiamond should have a collision event with the person

    • It should then play the diamond sound and destroy itself


Maze game 22
Maze Game 2

  • Place the door so that it blocks access to the target

    • Don't put any diamonds on the other side of the door!

  • In the person object

    • add a collision event with the door object, stopping the person and aligning it with the grid. 

    • Just the same as you did with the wall object

  • When all the diamonds are gone, the door should play a sound and destroy itself. 

    • Add the step event to the door object

    • Add the 'If the number of instances is a value' action.  (On the Control tab) Choose these options:

  • Step event : occurs once for every step of the game, which is usually 30 times a second.


Maze game 23
Maze Game 2

  • play a sound and destroy the door if there are no diamonds left

  • add block markers to our actions

  •  Save and play your game to test whether it works as expected.


  • Maze game 24
    Maze Game 2

    • The Target Marker

      • use a target that does not appear in the room until all the diamonds are collected

    • Create a marker sprite and object. 

      • Call them sprMarker and objMarker. 

      • Make it invisible by unchecking the Visible option.

    • use the step event

      • add an action 'If the number of instances (of the diamond) is zero,  Change the Instance to change the marker to the actual Target object

    • Place the target marker in the room where you want the target to appear.


    Reference
    Reference

    • Reference

      • http://ictmindtools.net/gamemaker/tutorials/

      • http://www.yoyogames.com/make/tutorials

      • http://forums.tigsource.com/index.php?topic=3251.0

      • http://www.learningplace.com.au/deliver/content.asp?pid=35421

      • http://madebyluke.com/gamedesign/tutorials/index.html

      • http://en.wikibooks.org/wiki/Game_Maker_Programming

      • http://en.wikipedia.org/wiki/Game_Maker

      • http://gamemaker.info/en

      • http://www.gmlscripts.com/gm8help/help/index.html


    ad