Game maker tutorial

Solo disponible en BuenasTareas
  • Páginas : 36 (8780 palabras )
  • Descarga(s) : 0
  • Publicado : 6 de enero de 2011
Leer documento completo
Vista previa del texto
Game Maker Tutorial

A Scrolling Shooter
Written by Mark Overmars Copyright © 2007-2009 YoYo Games Ltd Last changed: December 23, 2009
Uses: Game Maker 8.0, Lite or Pro Edition, Advanced Mode

Level: Beginner Scrolling shooters are a very popular type of arcade action game, and are also rather easy to create with a package like Game Maker. In this tutorial we will make such a game and, inthe process, you learn a number of aspects of Game Maker, in particular the use of variables. In a scrolling shooter the player controls an object, for example a plane, spaceship, or car, which moves over a scrolling background. Obstacles appear on the background that must be avoided and enemies appear that must be shot. Often bonus objects appear that can be picked up for addition benefits. Duringthe game the number, variety, and strength of the enemies increases making it harder and harder to survive. In this tutorial we will create a scrolling shooter called 1945, in which the player flies in a plane over a sea and enemy planes try to destroy the player. We will treat aspects like how to create the illusion of motion using a scrolling background, how to control the plane, how to makeenemies and bullets, and how to deal with the score, with lives and with the damage of the plane. But first of all we delve into a very important aspect of Game Maker that extends the possibilities considerably: the use of variables.

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 ofvariables. 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 changecertain 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 thex-coordinate of the instance y the y-coordinate of the instance 1

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 There are many, many morevariables, both local for the instances, and global. All of them can be found in the Game Maker documentation. There are actions which manipulate the value of certain variables but, as we will see, you can also manipulate them directly. What is better, you can define your own variables and use these as well. For example, as we will see below, we want our spaceship to be able to shoot only onceevery five steps in the game. So our space ship needs a property to indicate whether it can shoot. We use a variable for this property that we call can_shoot. (A variable name can only consist of letters and the underscore symbol. Variable name are case-sensitive, so Can_Shoot is not the same variable as can_shoot.) In the creation event of the spaceship we set this variable to 1 (we always use 1 to...
tracking img