Wait bug or not ?

0 favourites
From the Asset Store
2D fighting template based in the game that defined the fighting games genre.
  • Your events don't make sense, unless you have an image point named "loopindex".

  • + repeat 3 times tag:try

    -> Wait loopindex("try") * 2

    -> Console.Log("Fire")

    -> Spawn Image on Imagepoint(loopindex("try"))

    This does:

    Second 2: "Fire" + nothing

    Second 4: "Fire" + nothing

    Second 6: "Fire" + Spawn Image on Imagepoint("3")

    Tought you know what I mean with loopindex, is i?t now clear ? I try to spawn Images every X Seconds on the Imagepoints of a given Image ;)

  • Sharing a .capx is the clearest way to show what you mean and what isn't working.

  • Tought you know what I mean with loopindex, is i?t now clear ? I try to spawn Images every X Seconds on the Imagepoints of a given Image ;)

    I don't know the context of your code, but if you just want to spawn an image every few seconds why don't you just use this action then:

    System -> Every 2 seconds: Spawn Image on Imagepoint("3")

    Have fun

  • You will have to use a variable to do what you want, you just can't use loopindex with a wait.

    the Wait will not "pause" the loop. The loop will continue to run normaly at max CPU speed and finish instantly.

    2 seconds after, when your first "wait" countdown is finished, the loop already finished 2 seconds ago (instantly) and the loopindex will be null so you can't use it

    Here is a screenshot of what i understood you wanted, i'm using a variable instead of the loopindex

    <img src="https://dl.dropbox.com/u/5129970/constructforum/eventcapture.jpg" border="0" />

    the green sprite have 3 image point at different positions

  • Mimiste, BIG thanks to you. I�m lucky that some one understood what I wanted. I�m still not sure why i�t doesnt works with loopindex. Cause I tought it is the same like a local variable.

  • I understood what you wanted. I was just putting forth the case for a better method... well better from a oop perspective at least. heh

  • Now I found there 1 real Bug.

    If you spawn something in this loop and make directly after it something with it like "set angle". It does not change the created one, it change all instance.

    -> Spawn Sprite2 on sprite (image point sprite.WaitVar)

    -> Sprite2 set angle toward sprite.ImagePointX(sprite.WaitVar + 1)

    does change all instances

    -> Spawn Sprite2 (image point sprite.WaitVar

    + pick nearest Sprite 2 to sprite.ImagePointX(sprite.WaitVar)

    -> Sprite2 set angle toward sprite.ImagePointX(sprite.WaitVar + 1)

    does change only the right instance

  • newt

    You're still having to wait for the Timer bahavior?

    I'm doing my own Timer behavior with a simple code:

    Global or local variable: TIMER (Number);

    Every 1 sec add 1 to TIMER;

    For looping, it work like a charm.

    If you use it as a local variable:

    While TIMER < 4;

    Every 1 sec;

    DO

    Actions;

    and when you're using it as global variable (the case of a space shooting game, for example)

    Compare variable 10 < TIMER < 20;

    Every 1 sec;

    DO

    Actions;

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • For simplicities sake I would use the ease tween behavior.

    Then if you don't think its that simple, its at least reusable.

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