Thursday 4 May 2017

Outside the Box Project Beta Work - Gameplay Timer Script


When I code I look both to guidelines and concepts. I conceptualise and theorise how to go about solving a given task in code and then research guidelines to see if I am accurate. I say this because we wanted to have rounds and waves in our game, however as the sole programmer as of the start of Term 2 I struggled immensely to both conceptualise and research how to create a round system including feedback.

Due to this I had to figure out a way to generate both a lose condition and feedback for how long the level has left before the Player wins. Well maybe not a lose condition, that was just a convenient by product, but when a Tower Defence game informs their Player's which round they are on it is mainly for feedback to the Player to inform them as to their progress and how much of the level is left.

So I figured I'd include a time limit to the game, both as a lose condition but more as a way to generate tension. One of our core design outcomes we want for our game was for it to be engaging and tension has a by product of generating focus and engagement.

Narratively we worked this in as a parent setting up a time limit, after which the child who built the game would have to stop playing and go have dinner or something to that effect.


Basically in update I checked the float values and should the Seconds counter reach 0 then it resets to 60 and reduces the Minute value by 1 (hence -= 1, basically means subtract by 1). Should both the Seconds and Minutes values reach 0 then the game is over by changing the Time.timeScale to 0 and turning on the gameOver UI element that informs the player they lost.


Above is how it appears in-game, prior to having the Clock's texture applied.



Later on in development, rather last minute, I managed to create a feedback script that showed how many enemies were about to spawn and how many were left to kill like this: 4/5. The first number (4) representing how many are left to kill and the second number (5) showing the total that will spawn this wave.

I mention this as perhaps I could have just brute forced a round system by checking when all the enemies had been killed in the first spawn through this Enemy Spawn Counter and then, when those conditions were met, activating a UI Piece that simply stated "Round (insert appropriate number here)".

No comments:

Post a Comment