Aquanex2's Recent Forum Activity

  • dropbox.com/s/aw4oymi5f419cmx/ArraySave.capx

    Hmm it got a bit complicated.

    Basically - Each star is assigned unique values for its position in the array as instance variables. I used a loop to create the stars and assign values on one layout, you might do it manually as you design your levels.

    When it is collected (click), a 1 is recorded in the array at that star's unique position.

    Then, the function "CountTotal" goes through and adds up all the values inside the array to get the total number of stars collected, and displays it.

    I've added in events to save and load the array and current state of each star via LocalStorage as well, so it is persistant. You can right click to clear all data.

    Thanks a bunch! You've really helped me out a lot!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Might be simpler to just use the Persist behavior to make sure the stars don't respawn when you change layouts. That way you can just add 1 to your variable every time you collect a star, since you won't be able to recollect them.

    I would have to change the level select screen if I did that, but that could work.

  • I can make an example later, don't have C2 in front of me.

    But basically just think of an array as a spreadsheet, pretty simple. You can have one column for each level, and 3 rows which represent each star. In each cell, a 0 would represent not collected, and a 1 would be collected.

    When you collect a star, you would set that star's position in the array to 1. This way, if it was 0 before, it would change to 1, and if it was already 1, nothing would change.

    Then run a loop in the array, for each xy, that adds everything in the array. That would give you your collected star count.

    Example to come tomorrow!

    Thank you very much!!!

  • As long as there is no way to collect the star again after it has been collected (the star no longer appears on subsequent plays) it should work fine.

    Otherwise, you'll need a flag system to keep track of each star and it's state, if it has been collected before or not. An array may be a more suitable method of data storage in that case.

    That's what I thought. Arrays just confuse me a little so I thought I'd ask first. Do you know how I should go about doing that? An example isn't necessary but would be greatly appreciated.

  • Same answer? Or maybe I still misunderstand...

    Whenever you collect a star on any level, add it to a global variable counter. You now have the total number of collected stars from all levels.

    Global variables are global in that they keep their value across layouts.

    I get what you're saying, but will this still work if I don't want the total number of collected stars to exceed the total amount of stars in the game?

  • Use a global variable to keep track of total stars collected. For example lets call it TotalStars.

    On star collected - (System Actions) Add 1 to TotalStars.

    Then to display, you can use a text or spritefont object to set text to TotalStars.

    Let me rephrase that. What I want is to add together all the collected stars from all the levels. Thanks again.

  • The stages in my game have 3 stars hidden throughout the level. I want to add together all of the collected stars in a total and display them on screen. I already have set up where it will show, I just need help adding them together.

    Much Thanks!

  • It used to work just fine, but now Norm won't stop moving when he touches the goal.

    Before it stopped working, I was trying to fix my mute button, so I don't see how something completely unrelated could screw it up. <img src="{SMILIES_PATH}/icon_e_confused.gif" alt=":?" title="Confused">

    If image doesn't work, here's a link.

    https://drive.google.com/file/d/0B_LRNq ... VDYUU/view

  • > Hello! I'm new to Construct 2 so I dont know everything about this product. My question is:

    >

    > With the PERSONAL License could I export, publish and put ADs on my Android game( so I could monetize)? Or I need to buy the personal license and then buy some export modules later (Like Game Maker Studio)?

    >

    > Thanks for the attention guys

    >

    The Personal License allows you to monetize anyway you choose, with one proviso - that when you reach $5000 dollars, you would need to upgrade to the Business License.

    See Licensing for further information.

    How does Scirra know when you've made $5000 with a Personal License?

Aquanex2's avatar

Aquanex2

Member since 19 Nov, 2014

None one is following Aquanex2 yet!

Connect with Aquanex2

Trophy Case

  • 10-Year Club
  • Forum Contributor Made 100 posts in the forums
  • RTFM Read the fabulous manual
  • Email Verified

Progress

13/44
How to earn trophies