[R72] * Bug or Feature? * Sine, Spawn & OnOver

Bugs will be moved here once resolved.

Post » Fri Dec 23, 2011 10:58 am

I'm still working on my simple shooter, which utilizes sine behavior.

Ont thing that strikes me as a bug is the following:



Here you see, that I itterate over a certain amount to spawn targets. What is interessting is, that the "WAIT" step will not be executed, or hast no effect on the loop.
This causes that all targets, which will be moved by two combined sines are very, very close together - which then leads to the next issue:



When "shot" on and more then one target is at the same position ALL targets that share the x,y position are hit and removed - regardless of ther z coordinate....is this a bug or a feature?!?

Here is the CAPX

And here the online DEMO
B
42
S
19
G
12
Posts: 723
Reputation: 13,911

Post » Fri Dec 23, 2011 4:29 pm

'Wait' at the end of an event does nothing! Have you seen How to use the 'Wait' action?

'Wait' causes a delay then it carries on running from when it left off. If 'Wait' comes at the end of an event it means 'Wait this amount of time then do nothing', so it has no effect.

I guess you're confused because it's in a loop, but that doesn't make it wait between each loop iteration - instead it schedules waits in parallel, e.g:

+ Repeat 10 times
-> Do something
-> Wait 1 second

means "Do something then wait 1 second and do nothing, 10 times in a row". Events keep on running during a 'Wait' so the rest of the loop carries on running.

I'm not sure what you mean in your second example though, can you maybe reproduce it in a new empty project?
Scirra Founder
B
359
S
214
G
72
Posts: 22,946
Reputation: 178,518

Post » Fri Dec 23, 2011 4:38 pm

So how can I delay a loop?
B
42
S
19
G
12
Posts: 723
Reputation: 13,911

Post » Fri Dec 23, 2011 4:47 pm

Do you want to delay in between each iteration, or delay the start of the loop?

Just put a 'wait' before the loop itself (in a parent event) to delay the whole loop. To delay each iteration you can't really use the loop event, because the loop carries on running while the waits wait. In that case I'd just not use loops at all - have some timed events with variables or something.
Scirra Founder
B
359
S
214
G
72
Posts: 22,946
Reputation: 178,518

Post » Fri Dec 23, 2011 4:51 pm

ok, so the not delayable loop is a feature

For the "second" part of my question...

When spawned, a total of 10 instances will be created. All of them will be moved using two sine - both with random tweaks, so sooner or later the 10 targets will seperate BUT the are times, where more than one instance cover each other on the gamelayer. Now when they are shot ALL of them are "picked" and therefore destroyed - I'd rather have only one instance picked and killed....

Weishaupt2011-12-23 16:55:15
B
42
S
19
G
12
Posts: 723
Reputation: 13,911

Post » Fri Dec 23, 2011 11:17 pm

By design 'is overlapping' picks *all* the instances it's overlapping. I guess you need to follow it with a 'pick topmost' condition, but Sprite doesn't have one - I'll see if I can add it for the next build.
Scirra Founder
B
359
S
214
G
72
Posts: 22,946
Reputation: 178,518

Post » Sat Dec 24, 2011 6:56 am

Yes "Pick the topmost" would do very nicely - thank you!
B
42
S
19
G
12
Posts: 723
Reputation: 13,911


Return to Closed bugs

Who is online

Users browsing this forum: No registered users and 0 guests