Frogger Dev. Post 08

Today we got improved player logic, more logs, turtles that should work and you can now die in the water. The turtles works the same as the logs, but they have a hidden timer that ticks down, and when it reaches 0 they cease to be safe. If the player exists above the part where the water starts she will experience a loss of life unless she is on a log. Keeping track on this is a boolean Safe variable that simply switches to false at the beginning of every loop and to true if the player would happen to be on a log or turtle.

The player and all other objects also have a Back2start function that puts them in their starting position. On starting up the game goes through all objects in the gamestate and puts them in their correct place, this also happens to the player when she dies.

This function, alongside the functions that governs the Safe-variable are Virtual because they need to be accessed from GameObject but only handles Variables in PlayerObject so the logs, turtles and cars all have access to these functions even though they are never actually used for anything or even do anything. To my knowledge there isn’t much I can do against this as I need to change those variables and the alternative is to make them public in GameObject which I am not terribly fond of. Well, it’s not too much of a problem and I don’t think it’ll make a difference in the long run.

Still, it could take up some memory and cause weird stuff (or rather, no stuff since those functions are empty and doesn’t do anything) to happen if any other object calls the wrong function. If I get some time over I’ll see if there is a more efficent solution that doesn’t include me working my arse off to make it work.