STORY

Barry Buff - hero for hire (and his accomplice Asami in 2 player) have signed up to escort a princess and her ladies-in-waiting to their home land. Having purchased a map from a local trader, it doesn't take them long to realise that it's fake and has lead them to be helplessly lost in the middle of a wide expanse of plains. Not only that, but they soon realise that they've lost the princess and are now surrounded by some small green folk.
Their leader steps forward. 'We will return to you your princess if you can beat us in a game of Snatch the Wench.'
Our heroes look at each other dumbfounded, and realise that they must have stumbled into Goblin Gardens. There is nothing they can do but comply with the goblins silly game.


I feel like I'm wasting a lot of tokens with counters/timers in my game.
For example, most of my timers work like this:
timer -= 1 if timer <= 0 then timer = timer_reset --do stuff here end |
So I'm using a lot of global variables to store the timer values and timer reset values, as well as it not being a function in itself. I did try to make a function from it with something like:
function(timer, timer_reset) timer -= 1 if timer <= 0 then if timer_reset ~= nil then timer = timer_reset end return true else return false end end |
But that only reduces the timer variable within the function, and not the original. When looking up on if there was a way to reference the original variable, I just found posts saying this isn't possible in Lua.
Is there a better method for this?



Trubble Bubble is my tribute to the Atari 800 game Bubble Trouble.
The game is currently in development but I have made available a one level demo to play around with.
The objective is to manoeuver the bubble around the bath, collecting enough (10) to float out of the water and into the next level.
Hazards come in the form of dirt, which will deplete your bubble count, or bumping into the fish or the diving nail brushes.