Dev Diary: Bun-Dun Stages

Holy shit, I made another Dev Diary!

This is Klassic, and I’m going to talk a bit about how I went about creating the stage transitioning. Also, I’m going to shamelessly plug the Youtube video I just posted up in an attempt to make the rest of the Gamejolt competition scared silly. Or not.

First of all, the video:

Looking good, isn’t it? (Say yes)

You can see in the video that the stages are separated by a white -flash-, followed by a change in score and time requirements. The main character is reset to the centre of the screen and all existing energies are removed.

To newbies, it would seem as if I had simply changed the room, and if I’d wanted to I could easily have done so. However, such a development path doesn’t work well with the type of game we have in mind. To keep the constant game flow that we (hopefully) have achieved, we need to make sure that everything takes place in the same, well, place.

So, instead of changing the room for every stage, I put things into the hands of those lovely little creatures known as variables. Whenever a stage is completed, I instruct the game to create an object called ‘obj_whitefade’. This object is responsible for the visible flash on screen, but it’s also responsible for ‘resetting’ the room in preparation for the next level.

To do this, I have a few lines of code. Let me show you the one for starting Stage 3:

if global.stage=2

{

global.stage=3

global.scr=0

global.scrneed=14000

global.time=70

}

Let’s quickly run through this. The game does a simple check to see what Stage is just ending. In this case, we’ve just beaten Stage 2. Immediately, we change to Stage 3. That way, when the next Stage is beaten we can do the correct check. After we have changed the Stage variable, we want to make sure to reset the score variable. Otherwise, the player would only need to collect 2000 points in Stage 3 (Stage 2 requires you to collect 12000 points). Then, we up the required score for Stage 3, to increase the difficulty. Lastly, we give the player a bit more time to beat the level.

There are a few more components to this. Obviously, I need to remove all existing energies from the screen. This is simply done. All I need to do is run this code when obj_whitefade is created:
with obj_goodfloat instance_destroy()

with obj_badfloat instance_destroy()

with obj_boostfloat instance_destroy()

Gee, that was easy! Now, all instances of those names are gone.

What’s left… Oh right, resetting the player’s position. Two lines of text are necessary here (OH DEAR OH ME):
with obj_player x=xstart

with obj_player y=ystart

There we go, now the player is back where he initially began when the room first started.

Thanks for reading, everyone. I’m glad I finally got the opportunity to write another one of these. I hope you learned something, and if you didn’t I hope you enjoyed reading anyways.

Until next time,

Klassic.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s