gaps's Forum Posts

  • 5 posts
  • Only way I know how to do this is to have an intermediate object.

    That would be the tail in this simple example:

    Tail -> Pin to Cat

    Cat -> Pin to Tail

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Ok then, it is just not that intuitive... Maybe the documentation should mention that?

    Still, it's strange that some trigger events can be put inside foreach loops and others don't.

    Thanks for the insight!

  • In the mean time, I suggest that you add &Self.UID (eg "timer"&Self.UID) at the end of the timer name and that you check that the timer "timer"&Self.UID is over (I agree that it should be corrected)

    Wow that's a nice hack, thanks for sharing!

    I had some questions about how to "pass parameters" to a timer in its tag, but I gave up as I would have to know the parameter value to use it as a tag (I ended up using instance variables instead) - But now you showed me a way to do it, I guess!

    But I'll stick with my "foreach" workaround for now, as I think it is cleanner (don't know if it lacks in efficiency though), and that it also solves the issue for the "On collided with object" event (by the way, I've updated the problem description).

  • Problem Description

    After starting timers with the same name/tag for several instances, when more than one should trigger at the same time, only the first instance is picked (and the timer event triggers only once).

    A workaround is to have a "foreach" as a "super-event" (also works as a sub-event) around the timer trigger events.

    This is curious, because if you try to put other trigger events such as "On created" or "On flash ended" inside a "foreach", it will pop up a javascript error at runtime saying that is not allowed;

    But if you do it with events such as "On timer" or "On collision with object", then not only does this not yield any javascript error, but it also produces the expected behaviour (i.e. triggers an event for each instance that it was supposed to).

    In my humble opinion, it seems to me that some trigger events are not working as trigger events at all, but rather as standard (i.e. "picking instances") events.

    Also, no answer was found here:

    scirra.com/manual/75/how-events-work

    Nor here:

    scirra.com/tutorials/292/guide-to-construct-2s-advanced-event-features

    PS: A similar issue seems to occur with the "On collision with object" event, in the sense that if some object collides with two other objects at the same time, only one event is triggered. For most of the cases, that would not be a problem, since the instances are picked and the actions run for all of them, but in my case, I was calling a Function and passing the UID of the collided object as an argument, which results in only applying the Function to the first one. A "foreach" also resolved this problem.

    Attach a Capx

    [attachment=1:guc1pdoj][/attachment:guc1pdoj]

    [attachment=0:guc1pdoj][/attachment:guc1pdoj]

    Description of Capx

    Press each "1" button to trigger a "TimerOne" for it; Press "All" button to trigger a "TimerAll" for each.

    When "All" is pressed, you can see that the timer is set for all the "1" instances, but only triggers once, for the first one.

    When you press "1" buttons, a timer triggers correctly for each one, even when you press several very quickly.

    In the "Timer bug workaround.capx" the bug is corrected by having a "foreach" before the timer trigger events.

    Steps to Reproduce Bug

    • Start a timer with the same tag and the same duration for more than one instance of the same type;

    Observed Result

    Timer event only triggers once for some instance.

    Expected Result

    Several timer events should trigger, one for each instance for which the timer has been started.

    Affected Browsers

    • Chrome: YES
    • FireFox: YES
    • Internet Explorer: YES

    Operating System and Service Pack

    Windows 7 Service Pack 1

    Construct 2 Version ID

    163

  • I just made a huge improvment to this script in order to make the video object be drawn inside the canvas insted of in a separate video html element.

    This allows for example to have other game objects on top of the video, and also eliminates the "shrinking" and "delayed drag" behaviours verified in the current version.

    Not fully tested though.

    How should I release this changes I've made?

  • 5 posts