Time management game [FINISHED]

I finished my time management game! Be free to use it as a template in your own projects (credit would be appreciated). Suggestions on how to simplify my code would also be appreciated!

(I replaced my old topic with this one to prevent spamming so please ignore the first few comments)

https://github.com/G-nex/Time-Management-Game/blob/master/README.md

It doesn’t really serve a purpose other than wasting your time when you’re bored.
It was inspired by this game: http://hyperhippo.ca/games/adventure-capitalist/
Maybe it’s the curiosity to see what happens when you finish it, or maybe this generations is just really boring, but the game seems to be pretty popular. So I decided to copy its idea.

I guess the purpose is just trying to earn as much money as you can.

Or maybe the purpose was to just write code and see how hard/easy it was to get it working. The next step is to rewrite it and make it smaller.

Move this code to the end of the draw function.

    --Money
    fontSize(30)
    font("Arial-BoldMT")
    fill(46, 251, 9, 255)
    text("Cash:".."$"..cashString..cashSymbol, 150, HEIGHT-70)

That seems to have fixed it :slight_smile:

@G_nex Do you know why that fixed it. Just in case you’re not sure, here’s what’s happening. At the start of draw(), you set cashString=cash. Then you display cashString using the text command. After that you set cashString to cash divided by some value. Draw() starts over again at which point you set cashString=cash. At no point were you displaying cashString after doing the divide. By moving the text to the end of draw(), that was displaying the cashString value after the division.

EDIT: When writing a program, the code does exactly what you instruct it to do, not what it thinks you want it to do.

I knew why it worked, I think I just looked over it when trying to solve my problem Dx. I decided not to use cashString and cashSymbol as it kept giving problems.
Thanks for the help though :stuck_out_tongue:

PS. I finished the game :slight_smile:

@G_nex Here’s something I think is similar to what you’re doing. I wrote it back in
Nov 2012.

http://codea.io/talk/discussion/1874/how-s-your-reflexes#latest

@G_nex I played your game just to see what it does. Could you explain the purpose of it. It seems to be just a matter of hitting the red squares and then pressing BUY after a certain amount. I got all 8 red squares to show, but I’m not sure what was supposed to happen after that. While playing the game, I just kept hitting the screen without looking at what I was doing as I watched TV. I would occasionally looked back at the screen and hit BUY.