adding score to player when passing object

echohaker

Member
I'm working on a side scroller space shooter type game, where it uses a camera view, while the player moves along the game, I've added random Pipes to the game similar to like flappy birds, I'm trying to figure out how to add a score when the player passes the pipe, also all pips are spawn at once when the game loads, because the room is 20000 wide, with a camera view of 1220 x 768
 

Warspite2

Member
Create a variable in the create event of the pipe. Example...

PassedPlayer = 0;

Then in the pipe step event put this...

If x < player.x && PassedPlayer == 0
{
PassedPlayer = 1; //This is so it only scores once
Score += 100;
}

So assuming your game scrolls from right to left, as the player passes each pipe, 100 is added to the score only once.
 
Top