Curious Mike's Forum Posts

  • This tutorial might give you a good place to start:

    scirra.com/tutorials/280/creating-a-memory-match-game

  • If I've understood the question correctly, I think you can do this with a 2 dimensional array.

    Let's say you have a 6 by 4 grid

    Create an array object and set the size x=6, y=4, z=1. Rename the array to be called GRID.

    The data in your array will look like this (remember C2 arrays are zero based so the first row or column is 0 and the highest is (width-1):

    x

    012345

    y

    0 000000

    1 000000

    2 000000

    3 000000

    So now you want to put in a destroyer, which is 3 squares long, (and ship type 1) starting in the top left going horizontally. And a frigate (ship type =2) which is 2 squares long, starting in the bottom right and going vertically.

    You can do this by creating actions:

    GRID Set value at (0,0) to 1

    GRID Set value at (1,0) to 1

    GRID Set value at (2,0) to 1

    GRID Set value at (5,2) to 2

    GRID Set value at (5,3) to 2

    Now the data in your array will look like this:

    x

    012345

    y

    0 111000

    1 000000

    2 000002

    3 000002

    And you can see what ship is where. You can also do error checking to make sure you are not placing a new ship where one already is, and update the values in the array when a ship gets hit.

    Hope this helps.

  • Hey guys, these are some great tips! Thanks ;) I've started using some of them and it's helping a lot.

  • thebuglepodcast.com

    Listen responsibly ^^

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Hi all,

    What are your tips and best practices for creating C2 "code"?

    I'm a game designer and not by any means a programmer. I've just decided to restart my strategy game project as my "code" is too complicated and messy and it's not all working as I want it to. So I'm making a clean file and rebuilding. It seems like a good time to take stock of what I've learned.

    Best practices

    • Write a clear design document (e.g. in word)
    • Start small and simple (e.g. with small arrays)
    • Test often (e.g. show array variables in a text box on screen to figure out what is / isn't working)
    • Put complicated or repeated code into functions and call these from the main body of the code (less messy and less redundancy)
    • Save a new version of the project often so you can go back if you mess something up
    • Give variables a descriptive name
    • Add lots of comments
    • Break down functions to keep them simple (rather have a lot of simple ones than a few complicated ones)
    • I made a spreadsheet to work out where to place elements on screen (it calculates the midpoints)

    Worst practices

    • Build complicated functions (e.g. nested for-loops updating arrays) which then don't work (better to start simple)
    • Resize graphics within C2 (better to create them at the correct size e.g. in paint.net and import them cleanly)

    What do you think? Do you agree with these? What have you learned that we could add to this list?

    Thanks,

    Mike

  • Hi all,

    Does anyone have a .capx file which shows how to import data from a file?

    I've fiddled around with this for hours without success, including reading tutorials and forum posts and trying out plugins.

    What I have managed is to hack together a "json" format in Excel and copy/paste this in using the "Load from json string" into an array.

    I can create json and text files and bring them into the project. But loading from these files into an array just won't work for me.

    So if anyone can help with a .capx showing where I'm going wrong, I'd appreciate it!

    Thanks,

    Mike

  • Short: Try running steam as administrator.

    Long: I tried the C2 free edition on steam (under windows 7) then upgraded to the personal edition. But I still got the same error, unable to start http server. I guess some other people have had that problem too.

    What I found out was that steam was starting the free version and not the personal version. (Both versions were still installed). So what I did was this:

    • Backup C2 project data (just in case, you never know)
    • Uninstall all versions of C2 in steam
    • Restart PC
    • Install C2 personal in steam
    • Restart PC
    • Install C2 free in steam (steam did this when I tried to run the Construct2.exe as administrator)
    • Restart PC
    • Close steam (it autoruns on my PC)
    • Start steam with "run as administrator"
    • Start C2 with "run as administrator" (might work if you start normally too)
    • Win! Now I can preview my games on the ipad. Great!

    I hope this works for some of you experiencing this problem.

    Cheers,

    Mike

    • Hi Everyone,

      My name is Mike and I'm a gameaholic.

      I'm developing a strategy game for ipad using C2.

      I've had several game ideas going around in my head and on scraps of paper for years, and now I've committed to turning one of these into an actual game. This is my process:

      Great idea -> build it -> try and figure out why it didn't work

      I chose C2 because it's user friendli-er than other software and the community is very helpful (I've read a lot of tutorials and Q&As on the forums already). I hope you guys will help me out with stuff I can't get to work!

      Thanks,

      Mike