Bug? Spam-Creating

0 favourites
  • 6 posts
From the Asset Store
Fully commented source code/event sheet & sprites to create a space shooter game
  • Hello people! I have the following condition:

    <img src="http://screensnapr.com/e/H55eqs.png" border="0" />

    It seems that rather than just creating the four balls and then destroying the red ball it spam-created loads of continuous blue balls. it worked fine before I used the 'Wait' action. Is there something I'm misunderstanding here or would this happen to be a bug?

  • Tutorial: wait action

    This is not a bug, the wait action is working as intended.

    The way C2 reads your code is :

    Every rendering frame:

    .. Is red ball on screen ?

    .... If it is, wait 2 seconds, create 4 balls and destroy the red ball.

    And so, for the 2 seconds of "delay" you're expecting, each frame, there will be 4 more balls created, etc...

    You made some kind of loop that is memorizing a sequence of actions to do, and will do it once the timer is done.

    The fact is that since the wait action is the first, you'll have some kind of infinite loop going on.

    I suppose you're trying to have some delay between each ball you create ?

    Prefer using variables to make a kind of timer.

    You can check this topic and the capx I give as example it might be closer to what you are willing to do.

    Also I noticed you asked a few beginner questions/notices/suggestion, did you read the beginner's guide tutorial or Where to start ?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Tutorial: wait action

    This is not a bug, the wait action is working as intended.

    The way C2 reads your code is :

    Every rendering frame:

    .. Is red ball on screen ?

    .... If it is, wait 2 seconds, create 4 balls and destroy the red ball.

    And so, for the 2 seconds of "delay" you're expecting, each frame, there will be 4 more balls created, etc...

    You made some kind of loop that is memorizing a sequence of actions to do, and will do it once the timer is done.

    The fact is that since the wait action is the first, you'll have some kind of infinite loop going on.

    I suppose you're trying to have some delay between each ball you create ?

    Prefer using variables to make a kind of timer.

    You can check this topic and the capx I give as example it might be closer to what you are willing to do.

    Also I noticed you asked a few beginner questions/notices/suggestion, did you read the beginner's guide tutorial or Where to start ?

    You have the wrong impression, my apologies if It's my fault.. as ashley pointed out: scirra.com/forum/cannonball-fanatastic-physics_topic44933.html

    I'm making a timer that only suppose to happen when there's an explosive ball on screen, and it happens after 2 seconds, I used a manual timer that I created but Ashley suggested to me the Wait action so I threw my hand a try at it. And created this problem, I don't want it to wait 2 seconds between each one being created. if I wanted that I wouldn't be dumb enough to right this event (in the image) which is nothing alike that =P Silly :D

    I just want this event to happen 2 seconds after an "explosive ball" spawns on screen. And it seems to just spam the event and not destroy the red ball (well I don't know if it destroys it because it crashes)

  • All right, my bad, my assumption was incorrect indeed.

    Still, the fact is that during the 2 seconds of wait, actions are memorized and then duplicated.

    Strange thing is I tried to add a "Trigger once while true" condition to the "Is on-screen" condition, and then nothing at all happens. That was quite unexpected.

    Anyway, after having tried a bit a bit I came up with a solution.

    Simply place the "destroy red ball" action before the wait one.

    Then the red ball is destroyed, and two seconds later, 4 blue balls are spawned.

    But that's probably not what you want. I guess you want the ball to run it's course, then explode (spawn blue balls).

    The bug you are relating to appears to be a physics bug.

    Line 225 in Physics_behavior.js (right in the minified section) : a is null

    Apparently, this is the red_ball physics in cause, since the object was destroyed, but still trying to apply some function to it.

    Remove the physic behaviour to the object, you will just have a lot of spawns but no crash.

    For ashley : reproduction of the crashing capx

    Sprite = explode_ball; Sprite2 = blue_ball

    As stated above, placing the "destroy Sprite" action first, works. Spawning of Sprite2 occurs after 2 seconds, on the former position of the Sprite object.

    Adding a "Trigger once while true" don't seem to work.

  • In the other thread, when I suggested using 'wait 2 seconds', the event said 'on right mouse button clicked'. That triggers once every time you click the right mouse button.

    Here you've changed it to 'Sprite is on screen' - that runs 60 times a second so long as the sprite is on screen! So 60 times a second (about 120 times) you say "wait 2 seconds then spawn four balls...".

    So even after the sprite is destroyed there are a total of 480 balls queued up to spawn over the next 2 seconds.

    However, it did expose a genuine bug! I'll have a look at fixing that soon. In the mean time - either use the old way, or stick to a trigger like the original project.

    I'm moving this thread to the 'bugs' forum so I don't forget about the issue :)

  • In the other thread, when I suggested using 'wait 2 seconds', the event said 'on right mouse button clicked'. That triggers once every time you click the right mouse button.

    Here you've changed it to 'Sprite is on screen' - that runs 60 times a second so long as the sprite is on screen! So 60 times a second (about 120 times) you say "wait 2 seconds then spawn four balls...".

    So even after the sprite is destroyed there are a total of 480 balls queued up to spawn over the next 2 seconds.

    However, it did expose a genuine bug! I'll have a look at fixing that soon. In the mean time - either use the old way, or stick to a trigger like the original project.

    I'm moving this thread to the 'bugs' forum so I don't forget about the issue :)

    Yeah it was originally 'On Right mouse button click' but I created a new system for 0.2 of "Cannonball" and it uses a different "Cooler" system which I find awesome. I guess I could use a value then depletes every 1 sec, and at 0 it does it. like the original, until you fix it. Thank-you guys very much!

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