Where is it?

 

Where is it? 

Variables and properties

Before we will actually create the scrolling shooter game we need to delve a bit into an important concept of Game Maker: the use of variables. This simple concept will provide a very powerful mechanism to enable much more interesting game play. So what is a variable? It can best be seen as a property of an instance of an object. As you should know, there are certain properties we can indicate when we define an object. For example we can set whether it is visible or whether it is solid. There are also a number of actions that change certain properties. For example there is an action to change the position or the speed of the instance. Each instance has a number of such properties and there are also a number of global properties, like the score, that are not related to individual instances. All properties are stored in so-called variables that have a name. Here are some of the properties/variables that each instance has:

x the x-coordinate of the instance

y the y-coordinate of the instance

hspeed the horizontal speed (in pixels per step)

vspeed the vertical speed (in pixels per step)

direction the current direction of motion in degrees (0-360; 0 is horizontally to the right)

 

 

speed the 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)

And here are some global variables:

score the current value of the score

lives the 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

Direction Reference

  • 0 is right
  • 45 is up/right
  • 90 is up
  • 135 is up/left
  • 180 is left
  • 225 is down/left
  • 270 is down
  • 315 is down/right

Resources.zip Resources.zip
Size : 0.098 Kb
Type : zip
 
Make a Free Website with Yola.