Technical Updates

Until now, each level has only existed on its own, completely unlinked from any of the other levels I’ve currently created. This is mainly because the pink square that I’ve been using as my warp between rooms can only be used if the destination is in the same coordinates as the square on both sides. This is useful for entering and leaving buildings and caves, which I’ve made to line up with the main level structure -all buildings and caves are the same dimensions inside and out. However, in the transition between level one and two for example, the player jumps from an X coordinate of 2992 to an X coordinate of 688, so I’ve had to create a new item specially designed for transition between levels. The new icon uses all my artistic abilities and has formed this go faster arrow shape to differentiate itself from the standard warp square.

On contact with this object, I’ve set up variables who’s values are defined in the individual instances on the map. In the collision event I have:

room_goto(rm); //goto “rm”
obj_player.x = X; //the player object’s new X coordinate
obj_player.y = Y; //the player object’s new Y coordinate

Then, in the individual instance these figures are defined as something like:

rm = rm_2_1; //Level 2 part 1 (main)
X = 688; //new X position
Y = 178; //new Y position

This allows transition between any level regardless of score, so I’ve had to make only allow transition if a sufficient amount of flowers have been collected. Before now, I’ve used one datastructure list to hold information about the collected blossoms, but as this figure changes depending on the level the player is currently on, I thought the best course of action would be to create a unique datastructure for each level. In my GameInit script which runs at the beginning of the game, I now create four lists instead of one:

The first list controls collected sushi boxes. This was previously the same list used to hold information about collected blossoms, but as I’ve had to change everywhere in my code that uses one of the new lists it was simpler to leave this list there. The other three lists correlate to the three levels. I’ve also had to set up three different “gamescore” variables, which display the amount of flowers collected in the HUD and in the inventory. Because these are persistent global variables, each value will remain even if the figure doesn’t show. So when the player leaves and returns to level one for example, the figure will return to the previous global.gamescore1 figure.

The value of each is increased by one whenever a flower is collected, but now the room that the player is in affects which gamescore value is increased. I don’t know if this is the simplest method of achieving this, but I’ve set up the system in this lengthy but fool-proof way:

The || symbol represents the word or, so the top line of the code states that the following actions only apply if the player is in room 1_1 or room 1_2 or room 1_3 etc. The corresponding gamescore is increased by 1, the item collection sound is played and the information added to the appropriate datastructure list. The instance (the individual flower item) is then destroyed, as it has been collected and shouldn’t appear again! I haven’t had to create three different HUD objects as the player’s health remains constant throughout the entirety of the game, instead I’ve simply had to state which gamescore should be drawn depending on the current level. It’s a very similar process to before:

In order to determine whether a level transition will work depending on score, I’ve simply stated that gamescore1 must be over 9, gamescore2 must be over 14 and gamescore3 must be over 19. If not, the player won’t be able to progress to the next stage.

At the moment, the open transition is marked by my beautiful pink square sprite, so next on my to-do list is create an open door sprite to replace this with! You can now play all levels from beginning to end (as far as I’ve made, anyway.)


Leave a Reply

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

You are commenting using your 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