Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Expansion - A small town building game

edited July 2013 in Code Sharing Posts: 1,976

One day I thought about a small game where you had limited profits and had to build a town. Then I thought "I'm gonna make that." So I did. Ad here it is, Expansion. You start with a small grassy area with $50 and one shop for money, bringing in $5 per second. Save up and buy more shops, trees, flowers, houses, courts, churches, windmills, battle towers, and mines as you like. (Pay taxes, too. :P ) Build your town from the ground up and take a screenshot to show you friends your masterpiece. (Sadly, no town saving. :( )

Installer: https://gist.github.com/SkyTheCoder/5979558

Code: https://gist.github.com/SkyTheCoder/421ada49b89d52f38449

By the way, if you want to edit this and make it your own, change it enough to really qualify as a separate game. Once I've worked on this more, I hope to put it on the App Store. :D

Comments

  • Posts: 2,820

    I'm getting an invalid buffer name.

  • edited July 2013 Posts: 1,976

    No longer relevant.

  • Posts: 2,820

    Thanks. I'll try it out.

  • edited July 2013 Posts: 1,976

    No longer relevant.

  • edited July 2013 Posts: 1,976

    @Zoyt I edited the post to contain the gist.

  • Posts: 60

    This worked fine for me. I had to restart codea after using the installer but I think that is a known issue.

    FYI For being done in less then 24 hours, this looks sweet. Nice Job.

  • Posts: 1,976

    @Aalok Thanks.

    Oh, right, saving stuff is broken...still didn't work after I restarted Codea.

  • Posts: 1,976

    Derp, I was using the name 1aExpansion instead of Expansion and overwriting my code, and forgot to change the ProjectName variable...

  • Posts: 2,820

    The code you posted works for me.

  • edited July 2013 Posts: 2,820
  • edited July 2013 Posts: 1,976

    I seem to make a bunch of towns that are all exactly the same...

    My cookie-cutter towns

    They each have at least one of every building available, the perfect cookie-cutter towns.

  • Posts: 60

    Lol @zoyt. Very creative :)

  • Posts: 1,976

    If you want to add your own buildings, there's a template below the masses of building data. Just copy the template, paste it at the end of the building data table, customize it, and it's in-game. Very simple. ;)

  • Posts: 2,042

    @Zoyt I made the same town. It was so easy, and now I'm so rich

  • edited July 2013 Posts: 1,976

    Yeah, you get money pretty quick... It used to be even quicker, but I nerfed it. I hated games where it took you about five minutes just to get enough money to buy another shop, though... You can tweak how much money buildings cost and how much their incomes are at the top, it's simple enough.

  • edited July 2013 Posts: 2,042

    @SkyTheCoder, yup I saw that...

    Cheating@Expansion

    Clickable Link

    Hehe

  • Posts: 1,976

    Wow, I just tried it and I got four hundred and fifty thousand dollars in about three minutes...

  • Posts: 2,820

    @SkyTheCoder - I forgot to mention this:
    In case you didn't know, you can easily save your town data. Look here:
    http://twolivesleft.com/Codea/Talk/discussion/3050/save-load-a-table/p1

  • Posts: 1,976

    @JakAttak Haha, you can see I removed scientific theory from your money and income, but not in the building chooser...

    @Zoyt Dang, I wish I could add that but then it would be over twenty-four hours... I'll make a copy that's not. The original stays within twenty-four hours. Expansion+

  • BriarfoxBriarfox Mod
    Posts: 1,542

    Cool game :) looks nice and i'm having fun!

  • Posts: 1,976

    Working on Expansion+... @Zoyt's table-to-string function didn't work, so I made my own that recursively checks for multiple dimensional tables. Added in saving/loading (with unlimited save slots!), made it show tax rates, and raised prices so you actually have to wait for most things (Not too long, though.). Link: https://gist.github.com/SkyTheCoder/4bf470e3aa27a904fd7f

  • edited July 2013 Posts: 372

    The save feature makes a lot of difference to gameplay. I have two suggestions. 1) there should be sometime a building takes for construction. 2) I don't know if this is possible but if you could make things happen over longer time, i.e Over a span of half an hour or something. I just have to open the game after half an hour to collect my income from all the shops. Else the game finishes very quickly.maybe you could use OS date for it in someway, I'm not sure.
    EDIT: yep it's possible if you want to implement it. QUESTION:how do you shift to a new line while writing a post. I press return and it works while typing but when I save comment it ignores the return and puts everything in one big paragraph. I am using chrome on ios.

  • Posts: 1,976

    1) I shall make that

    2) I on purpose made things be quicker than that, because I hate games where it takes five minutes just to buy a second shop. Expansion+ makes it take a bit longer, but I will make it even longer if you want.

    And the return thing glitches with me, too, but I've found that using two returns, with an empty line in between can break it up.

  • Posts: 139

    Ok just to make you all aware not just this code but this is the most see able it makes the ghost affect meaning when you exit this app after you play with expansion you can glitch the screen and make a burned image come on witch you will see on the top left and top center it won't stay that way forever btw if this doesn't happen to you it might just be with my ipad 2,4

  • Posts: 1

    Can't seem to find the timer used in the code for generating income

  • Posts: 1,976

    @Madhatter It's declared at the bottom of setup, as oldTime. In the draw function, when it checks game states, it handles the timer at the top of elseif gameState == 2 then.

Sign In or Register to comment.