In my quest to make The Dino Game I have made a huge leap forward. As you can see above I am still working on the cave/dungeon system. Now that I have the new camera logic in I decided I should try and figure out the game-play. This is a super simple idea of a cave map.
The plan was to make it so when you enter a room the doors close and you have to fight the enemies and upon killing them all the doors open and you can move onward.
Super simple idea but surprisingly took me a while to get my head around how I should do it. I figured first that I would create a trigger that would make the enemies. That trigger would also close the doors. But how would I know when all of the enemies were dead and which doors I should open/close. If my cave has multiple rooms in it I don’t want to just open all the doors for the whole cave when you kill the first set of enemies.
In the end (I am rather certain it could be done more properly) I settled on having a trigger object.
this creates the enemy type i specify and how many of each I specify. It also shares the id of the specific trigger that spawned the enemies with the enemies. That way the enemies can reduce the enemy number variable of the trigger.
this is what happens when the enemy is destroyed so it needs to know exactly which trigger to reduce the enemy family from.
Once the enemies value is reduced down to 0 it then triggers the doors to open.
The trigger object has a few variables where I can specify the enemy type and the doors that should be affected as well as how many enemies I can spawn. I want to add the ability to have it spawn different types of enemies and different numbers of each type, that’s why things are in arrays but that’s future me’s problem.
One of the funny bugs I encountered is that after setting up everything it didnt work. It would only ever open one door and not both doors. It was only after way to long troubleshooting that I realized that I was still using the standard door open script that required you to have a key to open a door. I was randomly picking one up whenever i started the game so i could open one door but not both. I made a new script that didnt require a key and it worked like a charm
old door logic that is looking for a key
new door logic that isn’t looking for a key :)
As for the art side I had to animate the door and make a version for the up/down entrances as well as the left/right entrances. That looks like this.
Because I was a bit overly indulgent with the colors and detail in the gate it took quite a bit to color them all in. But it is cool to have a fancy gate.
Right that is all for now. Ill keep making the game and you guys gotta keep up being awesome!
-Dave