Problem with sounds!

0 favourites
From the Asset Store
75 explosion sound effects. Essential for many games, Explosions Sounds contains a mix of explosion and impact sounds.
  • No problem!

    Or you can do this:

    This means - if sound is playing, stop it. And then play the sound from the beginning.

    (oops, forgot to delete the old line with empty "" tag)

  • Your first solution works great so I'm going to stick with that one. You can't believe how happy I am now because I've been trying to solve this bullcrap for like 5-6 hours haha

  • Another thing I noticed - you have almost identical event sheets for levels 1 and 2.

    You can delete EventLevel2, and set the same event sheet for both layouts.

    If you need to do something different for each level, just check which layout is active:

  • How do I check which layout is active? When the Player collide with GOAL in the first Level, 1 is added to the variable Level2. When 1 is added to Level2 an object in LevelMap is created so you can get access to the second level. When the Player collide with GOAL in the second level, 1 is going to be added to variable Level3 and then create an object in LevelMap so you can access the third level and so on.

    Maybe it isn't necessary to have different variables to achieve that?

  • See my screenshot above how you check which layout is active!

    System->Compare two values -> LayoutName equals <your layout name>

    Instead of having separate variable for each level (Level1, Level2, Leve3 etc), just make one global variable LevelProgress.

    Add 1 after completion of each level to it.

    In your LevelMap check the value of LevelProgress and unlock next level icon. For example if LevelProgress=2, then level 3 is unlocked.

  • Thanks again, you are a true hero

    I do have a problem though (surprise, surprise!). At the end of the layout, 1 is added to LevelProgress and the next level is unlocked.

    LevelProgress = 1 = Unlock Level2

    LevelProgress = 2 = Unlock Level3

    The problem is if you play the first level twice, you'll also get LevelProgress = 2 and then the third level is unlocked.

  • Then don't do "Add 1 to LevelProgress" at the end of each level.

    Instead do something like this:

    If LevelName="Level1"  -> set LevelProgress to Max(1, LevelProgress)
    If LevelName="Level2"  -> set LevelProgress to Max(2, LevelProgress)
    If LevelName="Level3"  -> set LevelProgress to Max(3, LevelProgress)
    [/code:31prey72]
    
    So if user reached level 3 and then decided to replay level 1, LevelProgress will remain 3 (because of the Max function).
  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I just solved it with the solution below (and it works) but maybe yours is better?

    System / LevelProgress = 1

    ................System / LayoutName = "Level1" / System / Set LevelProgress to 0

  • I don't know how to set to Max :p

  • Just type it in the "Value" line

    While you are there, look for a semi-transparent window called "Objects with expressions", click it and select System - you'll find lots of interesting expressions and properties, including that Max function.

  • This doesn't work (what I have done, not what you say I should do) so could you tell me what I have done wrong?

  • It works now when I also added min(1, LevelProgress)

  • Nope, I thought it worked but it didn't

  • It works now when I got rid of "Add I to LevelProgress"

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)