Aquanex2's Forum Posts

  • My guy > collides with button > set button.variable to "active"

    button.variable = "active" and button.Y is greater than the ground > button.Y = button.Y - 0.2

    button.y = ground.Y > set button.variable to "done"

    button.variable = "done" > Do something

    That's probably how I'd do it

    ~Sol

    Thanks, but I've already figured it out how I wanted to do it. Nice alternative, though!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You can just move it down. Up to you.

    Okay. I think I know what I wanna do! Thanks everybody!

  • No, those are just potential options. It's up to you which is most appropriate. Generally collision is what you want to test, but something.s if the button is a one-shot, or has to be held down.

    My button is a one shot button, but I want it to be pushed into the ground when my guy lands on it. I just don't know whether to make it an animation or do something else.

  • My guy > on collision with/is touching/is overlapping button (event) > do a thing (action)

    Do the slashes mean to make it an OR block?

  • I'm creating a platform game, and I was wondering how I would create a button that my guy would have to land on to Activate.

    Any ideas?

    Thanks in advance!

  • Create a sub event and use

    Some Condition = true

    System>Trigger once while true> Play Music

    Set Condition = false

    As long as a Condition or Variable is true, it's true every tick so you need to switch it off or back to "false". If the music is not set to loop, it will only play once.

    Thanks! Y'know, I've never tried using that condition before... I never thought it could be used like that! Mind blown! :O

  • In my events sheet, I have it set up where it'll play a sound when a certain variable is true. The thing is, it plays it, but it won't stop! It just keeps playing the sound infinitely!

    How do I fix this? Any help is greatly appreciated!

  • I was able to download it... although it is my own dropbox. I'm not sure how to help there.

    I waited a bit and tried again, it worked this time! I'll let you know if I get it working!

  • Hey oosyrag, I'm having trouble downloading the capx... Dropbox is acting up for whatever reason. -_-

  • 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!

  • 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.