2D Platform Game Game Maker Terminology. Object Item in a game that has behavior, such as a main...

46
2D Platform Game Game Maker Terminology

Transcript of 2D Platform Game Game Maker Terminology. Object Item in a game that has behavior, such as a main...

Page 1: 2D Platform Game Game Maker Terminology. Object  Item in a game that has behavior, such as a main character who can move.

2D Platform Game

Game Maker Terminology

Page 2: 2D Platform Game Game Maker Terminology. Object  Item in a game that has behavior, such as a main character who can move.

Object

Item in a game that has behavior, such as a main character who can move

Page 3: 2D Platform Game Game Maker Terminology. Object  Item in a game that has behavior, such as a main character who can move.

Sprite

A picture or animation that defines how an object appears in the game

Page 4: 2D Platform Game Game Maker Terminology. Object  Item in a game that has behavior, such as a main character who can move.

Race Car

Object

Includes the behaviors or properties How it accelerates when

the gas pedal is pressed

How it stops when the brake is applied

How it turns as the driver rotates the steering wheel

How it screeches when it turns quickly

Sprite

The physical appearance of the car in the game. A picture or animation

that defines what the object looks like in the game

In Game Maker, a game item usually has both an object and a sprite.The object is the behavior and the sprite is the appearance.

Page 5: 2D Platform Game Game Maker Terminology. Object  Item in a game that has behavior, such as a main character who can move.

Why do we need both?

Having both allows flexibility For example, if we want a character to run and walk

both to the left and the right, we need many images or appearances for this character. The behavior will be the same.

Having the many sprites, all sharing the same object (behaviors), simplifies the designer’s work.

Our behavior – losing health if hit by an enemy – will be the same regardless of our character’s appearance – facing left or right.

Page 6: 2D Platform Game Game Maker Terminology. Object  Item in a game that has behavior, such as a main character who can move.

Bounding Boxes

A bounding box - a box that is used to estimate the area that a sprite takes up.

Bounding boxes are especially important for checking whether there is a collision between two objects.

When precise collision checking is on, a collision occurs only when a solid, collide-able part of a sprite inside the bounding box is touched. When precise collision checking is off, all pixels in the bounding box are solid and collide-able.

Page 7: 2D Platform Game Game Maker Terminology. Object  Item in a game that has behavior, such as a main character who can move.

Origin Point

The point in the sprite that corresponds to its position within the room. When you create an instance at a particular x/y position, the origin of the sprite is placed there.

The default origin point is the top left corner of the sprite.

Page 8: 2D Platform Game Game Maker Terminology. Object  Item in a game that has behavior, such as a main character who can move.

Origin Point continued The default origin point is the top left corner of the sprite but it is

often more convenient to use the center, which can be found easily by clicking the Center button, or some other point on the sprite.

You can set the origin point manually by clicking in the sprite image which will move the cross to the point you clicked, or by inputting different values for x and y in the corresponding boxes in the program. Note that you can even set an origin outside the area of sprite by using negative numbers (for left and up) or positive numbers larger than the sprite width and height (for right and down), which can be very useful when dealing with objects that need to draw composite sprites.

Page 9: 2D Platform Game Game Maker Terminology. Object  Item in a game that has behavior, such as a main character who can move.

Naming Game Maker requires that every resource (sprite, object,

room, etc.) has its own name. This makes each resource easily identifiable to both the game developer and the game engine.

There is a certain way to name everything we add to our games.

For each thing we add to our game (such as a sprite, object, or background), the first part of the name is the type of thing it is (i.e. object) and the second part of the name is what it is (i.e. main character)

In Game Maker, you can not use spaces in the names. So we put all the words together and capitalize the first letter of each word AFTER the first word. objectMain, spriteChaser, backgroundCoolPic

Page 10: 2D Platform Game Game Maker Terminology. Object  Item in a game that has behavior, such as a main character who can move.

Room

A level or scene (such as a title screen) in your game Each room has a grid which is not visible to the player.

You set the height and width of all cells in the grid by typing in values (in terms of pixels) in the snap X and Y fields.

When you place an object in the room by clicking, the origin of that object’s Sprite will snap to the nearest intersection on the grid. This makes it easier to place objects in straight lines and directly next to each other.

Page 11: 2D Platform Game Game Maker Terminology. Object  Item in a game that has behavior, such as a main character who can move.

Events

Things that happen during the course of the game. Some examples would be when the player presses a

key, when an alarm goes off, or when two objects collide.

Page 12: 2D Platform Game Game Maker Terminology. Object  Item in a game that has behavior, such as a main character who can move.

Actions

Operations that happen in response to an event. Some actions include moving, changing color, or

creating objects.

Page 13: 2D Platform Game Game Maker Terminology. Object  Item in a game that has behavior, such as a main character who can move.

Events and Actions

In Game Maker, an event is something that occurs in the game, while an action is a response to an event.

For example, when a player presses the right arrow key, that is an event. In response to this event, we designate an action – that a character moves to the right.

Page 14: 2D Platform Game Game Maker Terminology. Object  Item in a game that has behavior, such as a main character who can move.

Check Empty

Check Empty is an action which tests to see if a specified point generates a collision with the object in question.

The point can either be absolute or relative to the position of the object.

You can check for a collision with a solid object or with all objects.

This action is commonly used to check whether an object can move to a particular position.

In the example in our lesson, the computer checks if a position that is 6 pixels to the left of the main character is empty. The x value of -6 relative to the object means 6 pixels to the left of the character. If it is empty, the character will move to the left. (The calculations are based on the origin of the object.)

Page 15: 2D Platform Game Game Maker Terminology. Object  Item in a game that has behavior, such as a main character who can move.

Speed Horizontal

Speed Horizontal refers to motion to the left or right, in pixels per step.

A positive horizontal speed means moving to the right, and a negative horizontal speed means moving to the left.

A horizontal speed of -5 means that the character will move to the left at the rate of 5 pixels/step.

Page 16: 2D Platform Game Game Maker Terminology. Object  Item in a game that has behavior, such as a main character who can move.

Friction

Game Maker uses friction to control how quickly an object slows to a stop when the player releases movement keys. Setting friction to 0 will cause the character to continue sliding indefinitely. Increasing friction will cause the object to slow down quicker, and increasing it above the object’s movement speed will cause that object to not move at all.

By default, Game maker sets friction to 0.

Page 17: 2D Platform Game Game Maker Terminology. Object  Item in a game that has behavior, such as a main character who can move.

Battleship

Here is an example of a Battleship board.

What coordinates would be need to give to sink the ships?

Page 18: 2D Platform Game Game Maker Terminology. Object  Item in a game that has behavior, such as a main character who can move.

Coordinate System

A coordinate system is used in geometry to identify the position of a point or object.

Geometry replaces the grid boxes with points and divides an area into four sections (quadrants).

Similar to a map, a location is best identified by both its vertical and horizontal placement on a grid.

Page 19: 2D Platform Game Game Maker Terminology. Object  Item in a game that has behavior, such as a main character who can move.

Game Maker’s Coordinate System

There are two important differences between Game Maker’s coordinates system and the one used in geometry.

First, the origin point (0,0) is in the upper left corner of the game area.

Second, the y axis is positioned below the origin point.

Page 20: 2D Platform Game Game Maker Terminology. Object  Item in a game that has behavior, such as a main character who can move.

Keyboard Event

The Keyboard event is used to create an action when a key is pressed and continue that action until the key is no longer held down.

Another key option is KeyPress. Here an action only happens once when the player hits a key.

Page 21: 2D Platform Game Game Maker Terminology. Object  Item in a game that has behavior, such as a main character who can move.

Solid Objects

Marking an object as solid changes how Game Maker handles collisions.

It makes it so that the object cannot overlap with the solid objects. In the event of a collision, the colliding object will be moved away from the solid object until it is no longer colliding with it.

Page 22: 2D Platform Game Game Maker Terminology. Object  Item in a game that has behavior, such as a main character who can move.

Room

A level or scene (such as a title screen) in your game Each room has a grid which is not visible to the player.

You set the height and width of all cells in the grid by typing in values (in terms of pixels) in the snap X and Y fields.

When you place an object in the room by clicking, the origin of that object’s Sprite will snap to the nearest intersection on the grid. This makes it easier to place objects in straight lines and directly next to each other.

Page 23: 2D Platform Game Game Maker Terminology. Object  Item in a game that has behavior, such as a main character who can move.

Views Usually when we create large rooms, the game window expands

accordingly. With large rooms, this is rarely what we want. In order to control the size of the window, Game Maker has views.

Think of a view as a window or a camera into the room. Views allow us to zoom in on a portion of the room. Views can also be set to follow a certain object around the room, allowing the view to scroll around the room.

Page 24: 2D Platform Game Game Maker Terminology. Object  Item in a game that has behavior, such as a main character who can move.

Object Following

In Room Properties, object following allows you to select an object that the game will try to always keep onscreen. If the object moves to the far right of the room, the view will show more of the right side of the room based on the border settings.

The Hbor and Vbor values refer to the border size (in pixels) which must be present between the object and the edge of the view. This border helps the player see a portion of the area which the object is moving toward before it arrives there.

Page 25: 2D Platform Game Game Maker Terminology. Object  Item in a game that has behavior, such as a main character who can move.

Gravity Gravity pulls an object in a specified direction by increasing it speed

by a certain amount each step. In this way the speed of an object in a direction will increase over time, much the same way that an object speeds up when dropped.

Page 26: 2D Platform Game Game Maker Terminology. Object  Item in a game that has behavior, such as a main character who can move.

Create Effect

The Standard Edition of Game Maker contains this action which can produce a special effect, such as smoke, or an explosion or star. Identify the effect, its color and size, and where it should be placed relative to the object (its depth)

Page 27: 2D Platform Game Game Maker Terminology. Object  Item in a game that has behavior, such as a main character who can move.

Step Event

Identifies an action(s) which needs to be constantly considered b the game’s processor. A step happens every 1/30th of a second. For example, we may want the computer to constantly track the speed of an object, and limit it, so that it does not get too fast to disrupt the look or performance of the game.

Page 28: 2D Platform Game Game Maker Terminology. Object  Item in a game that has behavior, such as a main character who can move.

Scripts

Instructions we write to accomplish actions that are not available as part of the normal drag and drop icons. Scripts are written using the Game Maker Language (GML). A list of available instructions can be found in the Game Maker help file. In this game, we use a script to improve the main character’s collision with the platforms by allowing it to slide along walls.

Page 29: 2D Platform Game Game Maker Terminology. Object  Item in a game that has behavior, such as a main character who can move.

Lessons 6 - 8

In the next three lessons, you will continue building the game by adding chasers as well as scoring, lives, and health. You will work with the parent setting for objects, the Draw Event and scoring actions. You will also start working with both included Game Maker variables and creating your own.

Page 30: 2D Platform Game Game Maker Terminology. Object  Item in a game that has behavior, such as a main character who can move.

Conditional Statements with the Else Action

In computer science, a conditional statement identifies what the program should perform if a condition is met or is not met. It works like this – if the condition is met, the perform and action; else perform another specified action.

Page 31: 2D Platform Game Game Maker Terminology. Object  Item in a game that has behavior, such as a main character who can move.

Draw Sprite

Game Maker draws a sprite during each step of a game. If you wish to give specific instructions on which sprite to draw, where to draw it, or which subimage to use, use a draw sprite action in the draw event.

Page 32: 2D Platform Game Game Maker Terminology. Object  Item in a game that has behavior, such as a main character who can move.

Parent Objects

A parent object provides behavior that can be copied onto another object. That means that all events and actions of a parent object will also occur with the child object.

Using parent objects can save time in situations where you wish to have one object use the exact same or similar events and actions as another object.

Page 33: 2D Platform Game Game Maker Terminology. Object  Item in a game that has behavior, such as a main character who can move.

Variable

In computer science, a variable is a name that keeps track of something. In Game Maker, a variable keeps track of a quantity or value.

In the 2D maze game, we create a variable to keep track of the direction that the main character is facing at any given time. This helps make sure that the main characters’ throw is in the same direction that this character is facing. The variable stores the direction in terms of degree (0° if facing to the right, 180° if facing to the left).

The important thing to remember is that a variable is a name which acts like a storage container and consists of a value which can change.

Page 34: 2D Platform Game Game Maker Terminology. Object  Item in a game that has behavior, such as a main character who can move.

Finishing the Level - Lessons 9 – 13

In the next five lessons, we will finish building the first level. We will add prizes, another chaser and the goal. We will also add a title screen and learn how to add sounds and additional rooms to the game.

Page 35: 2D Platform Game Game Maker Terminology. Object  Item in a game that has behavior, such as a main character who can move.

Lesson 9 – Adding Prizes

We will add a prize for the player to collect for points. This will give the player extra incentive to explore the level.

Steps

Create a sprite and object for the prize

Make a collision between the main character and the prize – the main character will gain points and the prize will disappear

Place prizes in the room

Page 36: 2D Platform Game Game Maker Terminology. Object  Item in a game that has behavior, such as a main character who can move.

Lesson 10 – Displaying Health and Score

We will add an object that will display the health and score on the screen. This will make it easier for the player to see the main character’s health and keep track of the score.

Steps:

Create an object for display. It won’t have a sprite associated with it because we will be creating a Draw Event for it. Set the depth of this object to be lower than all the others so that it displays on top of everything.

Create a font to draw text (for the score and health) on the screen.

Define the draw event to display the health and the score. We will use some variables provided by Game Maker to make sure that the display always stays in the upper corner of the screen.

Place the objectDisplay in the room.

Page 37: 2D Platform Game Game Maker Terminology. Object  Item in a game that has behavior, such as a main character who can move.

Lesson 11: Making a Second Chaser To add more excitement to the game, we will add a second type of

chaser. This chaser will move up and down through the air. This chaser will be especially dangerous. If this chaser lands on the main character, the main character can lose a large amount of health.

Steps:

Add a Sprite. This chaser will not change directions, so pick a sprite that faces forward.

Make an object for our second chaser. Duplicate the first chaser’s object to get started.

Edit a few events on the second chaser. For the create event, change it’s movement from moving left and right to moving up and down.

Delete the draw event since the chaser will no change sprites.

Add a collision with the main character. Again, it will react exactly the same as the first chase, so duplicate that event.

Add a collision between our new chaser and the main character’s throw object. Again, it will react the same way as the first chaser, so we can duplicate that event.

Place new chaser in the room. Make sure you place a U-turn helper objects to keep the chaser in the room.

Page 38: 2D Platform Game Game Maker Terminology. Object  Item in a game that has behavior, such as a main character who can move.
Page 39: 2D Platform Game Game Maker Terminology. Object  Item in a game that has behavior, such as a main character who can move.

Subimages

A subimage is one image or frame of an animated sprite.

Any sprite can have one or more sub images. The game cycles through these subimages in order to animate the sprite.

Subimages are numbered starting with zero, so the first subimage in a sprite is frame0, the second is frame1, and so on.

Page 40: 2D Platform Game Game Maker Terminology. Object  Item in a game that has behavior, such as a main character who can move.

Align to Grid Align to Grid – this action forces the position of an

object to align to a grid, so that the object stays on the grid and does not get stuck in neighboring objects.

When an object aligns to grid, it moves or snaps to the nearest grid space based on the horizontal and vertical values designated.

Example: If you define a grid of 10 pixels by 10 pixels, it could snap to the nearest position that is a multiple of 10, such as (10, 10), (20,10), (10, 20), (100, 130), and so on.

Page 41: 2D Platform Game Game Maker Terminology. Object  Item in a game that has behavior, such as a main character who can move.

Relative

Selecting relative will add the specified value to the variable.

In terms of scoring, if the score value is relative, that means that the points well be added to the current score.

Example: If a player’s score is 100, and he/she picks up a prize with a value of 20, the new score will be 120 if relative is checked. If relative is not checked, the score becomes the absolute value of the prize – in the case of this example the score would be 20, even if the played had a score of 150 before getting the prize.

Page 42: 2D Platform Game Game Maker Terminology. Object  Item in a game that has behavior, such as a main character who can move.

Conditional Statements with the Else Action

In computer science, a conditional statement identifies what the program should perform if a condition is met or is not met.

It works like this – if the condition is met, then perform an action; otherwise (else) perform another specified action.

Page 43: 2D Platform Game Game Maker Terminology. Object  Item in a game that has behavior, such as a main character who can move.

Sounds Music and sound effects help to make a game

interesting and realistic. To add sound in Game Maker, first obtain a sound file.

WAV files are ideal for sound effects, and MIDI files work well for background music

You can record your own sound using a program such as audacity.

After importing your sound into Game Maker, you can add special effects such as Echo or Reverb.

Sounds can be used for collisions, picking up prizes, and reaching goals.

Page 44: 2D Platform Game Game Maker Terminology. Object  Item in a game that has behavior, such as a main character who can move.

Variable

In computer science, a variable is a name that keeps track of something. In Game Maker, a variable keeps track of a quantity or value.

In the 2D maze game, we create a variable to keep track of the direction that the main character is facing at any given time. This helps make sure that the main characters’ throw is in the same direction that this character is facing. The variable stores the direction in terms of degree (0° if facing to the right, 180° if facing to the left).

The important thing to remember is that a variable is a name which acts like a storage container and consists of a value which can change.

Page 45: 2D Platform Game Game Maker Terminology. Object  Item in a game that has behavior, such as a main character who can move.

Test Instance Count

A control action in which you specify an object and a number of instance of that object. This can be used to check whether all instances of a particular type are gone, so that a level or game ends.

Page 46: 2D Platform Game Game Maker Terminology. Object  Item in a game that has behavior, such as a main character who can move.

Alarm Alarm – a timer that decreases by 1 step, each step

is 1/30th of a second. When you have actions that you would like to do

later or repeat after a certain amount of time passes you can accomplish this with alarms.

Alarms are countdown timers, just like you see on the microwave, at a basketball game, or sitting next to your bed. Once the alarm goes off, it signals the object to take action.

You need to use an action to set your alarm