Bug? Spam-Creating

Bugs will be moved here once resolved.

Post » Thu Sep 29, 2011 5:43 pm

Hello people! I have the following condition:



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?
B
17
S
4
G
5
Posts: 226
Reputation: 4,042

Post » Thu Sep 29, 2011 6:15 pm

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 ?
New to Construct ? Where to start

Image Image
Image Image

Please attach a capx to any help request or bug report !
Moderator
B
247
S
85
G
40
Posts: 6,999
Reputation: 57,793

Post » Thu Sep 29, 2011 7:34 pm

[QUOTE=Kyatric] 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 ?[/QUOTE]

You have the wrong impression, my apologies if It's my fault.. as ashley pointed out: http://www.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)
B
17
S
4
G
5
Posts: 226
Reputation: 4,042

Post » Thu Sep 29, 2011 8:39 pm

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.
New to Construct ? Where to start

Image Image
Image Image

Please attach a capx to any help request or bug report !
Moderator
B
247
S
85
G
40
Posts: 6,999
Reputation: 57,793

Post » Thu Sep 29, 2011 9:55 pm

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 :)
Scirra Founder
B
359
S
214
G
72
Posts: 22,951
Reputation: 178,578

Post » Thu Sep 29, 2011 10:14 pm

[QUOTE=Ashley] 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 :)[/QUOTE]

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!
B
17
S
4
G
5
Posts: 226
Reputation: 4,042


Return to Closed bugs

Who is online

Users browsing this forum: No registered users and 3 guests