Dalal's Forum Posts

  • I guess the best workaround for neatness and improved maintainability is to define all functions in one event sheet, along with global constants to reference those function names. Whenever a function name has to change, simply make two changes - one to the trigger, and one to the global constant.

    That doesn't seem too bad I guess.

  • I wonder if there would be any issues if Ashley revised "cf_fast_trigger" to allow for referenced constants. Isn't it essentially the same thing since it still restricts the name to a constant that is never going to change during run-time?

    One obvious example for why allowing this is a good idea: one might use the Function trigger in multiple places throughout the code. Then, if it comes time to rename the function, it must be renamed everywhere, including all calls to that function. If a constant was being used in the condition and in the calls, renaming wouldn't be an issue.

  • Not sure whether to call this a bug or not, but it's definitely counter intuitive enough to me that it seems like it could belong here

    Problem Description

    On Function condition won't let me use a constant value as a function name.

    Steps to Reproduce Bug

    • In a new project, add the Function object.
    • Create a global constant text with an arbitrary name.
    • Attempt to create an On Function condition referencing the global constant as the function name.

    Observed Result

    We get a message saying "Parameter must be constant".

    Expected Result

    I would expect that referencing a global constant qualifies as the parameter being constant.

    Construct 2 Version ID

    r170.

  • Because they are static variables, the Function object won't be able to access all the static variables that are spread across events.

    EDIT: Nvm, of course it can! Function is a trigger that can be placed in multiple places. I was running on very low sleep

  • Maybe I'm sleep deprived, but I don't believe there's an easy way to reset all static variables, as there is with globals.

    Why do I need to do this? Many of my "global" variables are actually static variables in an 'Every Tick' (which I use to limit their scope to the event sheet they belong in). Now, just as I can reset global variables, I need to reset static variables. What should I do?

    I would hate to store each variable in a key and reload. There's gotta be a better way! Any ideas?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Whiteclaws has the answer, though I like to use lerp to simplify the code. Same thing as Whiteclaws' answer, in a different format. Set the circle size to:

    lerp(CircleMaxSize, 0, PlaneDistanceTraveled/SizeOfLine)[/code:2et1ixuy]
    
    Basically we are saying, start circle out at CircleMaxSize, end circle at 0, as PlaneDistanceTraveled/SizeOfLine goes from 0 to 1.
  • Set the Period Offset of one of the instances to half the period.

  • Hmm, could you attach a file that shows your example using "tons of" Touch | On touched events? Then we can see if there's a good way to simplify it. I think that without a good context, it's hard to know how to use variables to simplify the code.

    For example, if the 4 sprites all behave the same way, you can add them all to a Family and then make one Touch | On touched event for the Family.

  • I'm having trouble understanding why "Trigger Once" is not working as expected in this context (see attachment). I'm not looking for workarounds, I'm simply trying to understand why it's doing this.

    The Code

    I have an object "Sprite" with a variable called "Color". Every second I destroy all existing "Sprite" objects and then create two new ones - one with Color explicitly set to 0, and the other with Color set to 1. After that, based on the value of Color, I set the animation of each "Sprite" object to either "Color0" or "Color1".

    Expected Behavior

    Every second, I would expect to see one yellow "Sprite" and one blue "Sprite". This is because the "Color = 1" condition for the newly created sprite has never run in the previous tick. It may have run for a previous object, but not for the newly created one.

    Actual Behavior

    After the first round of creation, both sprites end up being yellow. This is presumably because "Trigger Once' doesn't care about which object it is firing for, it merely checks to see if the same event happened in a previous tick. But I could be missing something.

    Exactly what's going on here? Can someone break it down for me?

    Thanks!

  • Is no one else having this issue? It can't just be me. If you've got an Android device, could you please go to the audio test page with your phone browser (Chrome preferably) and see if there's any delay in sound playback?

    If there is, then please post your phone model and operating system in the bug thread I started for this issue. I really appreciate it!

  • Problem Description

    For HTML-5 games and also CocoonJS compiled games, sounds are significantly delayed (up to half a second) on the Samsung Galaxy S4 (tested myself) and the Galaxy Note S2 and up (tested by others), and perhaps other Android phones. This is using the Scirra recommended browser, Chrome. According to friends, it also happens in Firefox, but I have not yet tested this myself.

    Test Application

    http://www.scirra.com/labs/audioeffects/

    Steps to Reproduce Bug

    • 1. Go to Chrome on a Galaxy S4 and navigate to the test application at the address above.
    • 2. Play the short SFX1 and SFX2 sounds repeatedly and notice the consistent delay.

    Observed Result

    There is a definite delay in playing the sound as compared to a web browser on a laptop/desktop.

    Expected Result

    The sounds should play instantly as they do on a laptop/desktop browser.

    Affected Browsers

    • Chrome for Android: (YES)
    • FireFox for Android: (YES ?)

    Construct 2 Version ID

    r167.2

    Notes

    When using CocoonJS to export, the same delay happens. Everything else is accelerated (the game runs at 60 FPS), but the sound is delayed. I understand that this issue may be phone specific, but I wanted to bring this to your attention in case it wasn't already, with the hope that something can be done in the near future to make C2 exports compatible with these phones.

  • That's not a bad idea. I'll verify that the sound is delayed across multiple phones, and then I'll probably fill out a bug report. Thanks!

  • Thanks for all the insight. Unfortunately, I'm not using physics and the sound delay also occurs on this: http://www.scirra.com/labs/audioeffects/

    It works fine on the computer, but on Chrome on my Samsung Galaxy S4 the sounds are delayed by half a second or more. What a bummer.

  • I appreciate your help man. Just had a friend test it on his Galaxy Note which is a couple years old - he didn't say which version. But the sound was apparently delayed on there too, using both Chrome and Firefox. Weird! These things are a bit frustrating

    My events are structured as follows:

    On Collision with 'Wall' --> Audio: Play Bounce not looping at volume 0 db (tag "")[/code:38qliout]
    It's similar for every time I play the audio. Nothing seems to be particularly wrong with the way I've coded this.
  • Hehe, that was the edit

    There isn't any delay on my computer but surprisingly, over LAN I get the same delay as on CocoonJS! That's very disappointing. What could be going on?