This video pretty much sums up what I’ve been doing for the past few days, mainly with the background graphics and building interiors, and a few other graphical elements. From creating and playing back this video, I came up with an extensive to-do list based on bugs, flaws and things that don’t fit well or look right! My aim for this week is to fix everything that needs fixing, while away from the computer I’ve started to design the next level which now needs tracing.
Things To Do:
- Sort out problems with the lighting (solved)
- Sort out problems with particles (solved)
- Delete accidental “invisible platforms” (solved)
- Reduce the amount of lights inside small buildings (solved)
- Sort out collision with cave walls problem (solved)
- Animate some existing assets, like flags and the Maneki Neko
- Make health restoration item
- Apply more accurate collision masks to objects
- Improve environmental tiles
- Make new sprites for rope bridges, statues, outdoor tables & chairs and Ikebana
The biggest task here was the problem with the lighting system, which occurred when re-entering an already visited room. The code which draws the lights is called every time the room is entered, but because my rooms are persistent (changes to the room remain even if the room is left), the code was only being called when the room was entered for the first time. The result was that lights weren’t being drawn in revisited rooms, but would stay on from the previous room ie. the last place the code was called. I realised this by a long process of trial and error…
The rooms had to be persistent (or so I thought!) to stop the player from being able to collect the same flower twice. In a non-persistent room, the flowers would respawn if the player left and re-entered. There are however a couple of ways to prevent collected items from respawning, without having to create a room which is persistent. I found this post from the Game Maker Community forum to be really helpful. One of the solutions suggested on this thread is to use a datastructure, in this case a list of all items in the level with their own unique ID.
This is a script called gameInit, which is called once when the game starts. Gabriel Verdon uses a similar script for The Archer, to set global variables and position control objects etc. You can see that this script determines the keys used which correlate to the user controls, and generates the player object, HUD objects and the effects control object- all of which are persistent and remain throughout the game once called. At the top of the script, I added a generate list command, which will hold the information of flowers collected throughout the level.
This code is from the create event of the Sakura blossom object. The item is placed onto the list when it is deleted recorded by a unique ID, and this code commands a respawned item to be deleted again if it is on the list.
So now my lights stay on in the rooms they’re supposed to be on in! Most of the other fixes on the list were relatively little, some involved reducing collision masks and the rest involved clearing up some of my human errors. What I really want to see now is finished visuals.