
GameMaker Programming By Example
By :

For this chapter, you can just work in your previous game and continue to edit that, so you don't need to make any new game projects. Open your infinite platform game, and we'll start with putting in the score system. We will get into drawing and saving it later.
First, add a Create event to the platform object. Inside it, set a variable called hit
to false
, and it will tell whether or not the player has bounced on it. The player should only be able to score points from a platform once, so that's why we have to put in this variable. Next, below everything you already have in the Step event for the platform, test for a collision with the player, and also it is required that the variable we set before is false
. If so, increment the score
variable (a built-in global variable) by 10
, and set the hit
variable to true
, so that the player can't get more than 10 points per platform:
if (collision_line(x + <left edge of bounding box value>, y...
Change the font size
Change margin width
Change background colour