Basic Skills 2
Interactions
You have created the basic structure of a game. Now to create interactions Events and Actions.
- objWall – NO Events

- objPlayer – Create and Step Events

// CREATE CODE
//—–set player speed
n_spd = 2; //—–normal speed
r_spd = 3; //—–run speed
spd = n_spd; //—–set start speed
hspd = 0;
vspd = 0;
runspd = 0;



- objEnemy – Collision with objPlayer

// COLLISION WITH OBJ_PLAYER CODE
game_restart();
- objTarget – Collision with objPlayer code

//COLLISION WITH OBJ_PLAYER CODE
score += 10;
instance_destroy(self);
- objController – NO Sprite, initialise game variables
Now, to show score, we need a special object withot a sprite – objController or objManager. This controls things such as Health, Lives, Scores, etc. It is placed on the first room, but does not show in the game.
In this case, the Score is set initially to 0. Health might 100, say, etc. In other programs these are called global initialisers and global values.
The Scores, etc, are displayed using Draw Events, which can be place in the room.

//CREATE CODE
score = 0;

//DRAW GUI CODE
//—–setup the font
draw_set_font(Font1);
//—–print out the text
var mystring = “Score: “+ string(score);
draw_text(10, 0, mystring);
- Save your work and RUN THE GAME.
** Next -> Create a maze game or something for tutorials **