influogames's Recent Forum Activity

  • ...but not during the game.

    By this, do you mean after exporting the game?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Nefron89 Forgot to mention that it is actually a Chrome "problem". They have changed autoplay policies since 2018:

    developers.google.com/web/updates/2017/09/autoplay-policy-changes

    So, you can use one of the PabloDev solutions.

  • What I usually do to "fix" this problem, is to have a Loader Layout and display a "Touch to start" text to force the user to make the first input.

  • Text extracted from Construct manual

    scirra.com/manual/109/audio

    Mobile limitations

    Safari on iOS and Chrome for Android share a limitation in playing music. While sound effects can be played at any time, music is only allowed to start playing when the user touches the screen. This is a limitation in the browsers themselves. As a result, if you play music on the start of layout, you may find in these browsers it does not actually start until the next touch.

  • But that's not the intended behaviour? To check all the paintings and if their hangingProcess is >= 100?

    If you want to check just for the painting that was clicked on, there's no need for the foreach loop.

    I would do something like this:

  • For example, you could create a function calling your foreach loop. Then call that function in Mouse click event.

    Something like this:

    Mouse On Left button Clicked on Sprite_painting: Call "Your Function"
    	...
    On "Your Function"
    	System For each Sprite_painting: ...
    
  • Oh... okay, there's the problem. The foreach loop is executing every tick because it is not inside in any triggered event. Although is nested in a group it doesn't mean it will execute your code once. I think the best place to put your code is inside the Mouse click event. It would mean that you'll have to refactor your code a little bit.

  • Could we see the events above that foreach? Is it nested in another event/condition?

  • Just to further explain what were happening with your code...

    You were telling the program to check for each instance of Sprite_painting if the hangingProgress was higher or equal to 100, and if that condition was met it was executing the Trigger once for that particular instance. Then, when you executes the code a second time the program checks all instances again, BUT this time, because Trigger once was already called the program ignores it and you get an "infinite loop".

  • Hey man! Instead of adding the trigger once event, add the Stop loop action from System, right after your "Audio Stop..."

    Then you can move all your actions inside the Trigger Once event after the Stop loop.

  • *Note: Your sprites names will have to be renamed as well to match the elements from XML.

  • Oh, ok, there was a problem with naming rules.

    Text from the link:

    Element names must start with a letter or underscore

    So, your XML should be:

    <?xml version="1.0" encoding="UTF-8"?>
    <Niveau>
    	<A1>open</A1>
    	<B1>open</B1>
    	<C1>close</C1>
    	<D1>open</D1>
    
    	<A2>open</A2>
    	<B2>open</B2>
    	<C2>close</C2>
    	<D2>close</D2>
    	<E2>close</E2>
    </Niveau>
    

    Also, put this in a proper XML file (.xml extension), not in a .txt file.

influogames's avatar

influogames

Member since 7 Mar, 2013

Twitter
influogames has 165 followers

Connect with influogames

Trophy Case

  • 11-Year Club
  • Entrepreneur Sold something in the asset store
  • x5
    Popular Game One of your games has over 1,000 players
  • x3
    Famous Game One of your games has over 10,000 players
  • Viral Game One of your games has over 100,000 players
  • Regular Visitor Visited Construct.net 7 days in a row
  • RTFM Read the fabulous manual
  • Great Comment One of your comments gets 3 upvotes
  • Delicious Comment One of your comments gets 10 upvotes
  • Email Verified

Progress

20/44
How to earn trophies