Problem with relatively simple events

Discussion and feedback on Construct 2

Post » Sat Feb 06, 2016 4:43 pm

Hi, I'd appreciate some help with this.

Pls. take a look at url: http://occupy.bitballoon.com/

The small blue squares looks to occupy the big squares for 3 seconds at a time. A big square can only be occupied by one blue square at once. The big squares are colored green when unoccupied and red when occupied.
The problem is that after a while, at an arbitrary point in time, some of the big squares enters a permanent occupied state with no occupants.

Events:
Image

Capx: https://drive.google.com/file/d/0B6WdU53eEV7JcUdwRWd0eUlaZWc/view?usp=sharing

Edit: capx link fixed.
Last edited by thegrind on Sat Feb 06, 2016 7:01 pm, edited 1 time in total.
B
26
S
9
G
2
Posts: 78
Reputation: 2,524

Post » Sat Feb 06, 2016 5:25 pm

Looks like you linked the wrong file. Chances are you have multiple hits at the same time, so you aren't trimming that down to only a single one. Try a "Pick instance 0" in event 4, or as a sub-event.
ImageImageImage
B
71
S
22
G
248
Posts: 3,761
Reputation: 138,073

Post » Sat Feb 06, 2016 7:01 pm

I did, thanks. This is the right one: https://drive.google.com/file/d/0B6WdU5 ... sp=sharing
B
26
S
9
G
2
Posts: 78
Reputation: 2,524

Post » Sat Feb 06, 2016 7:08 pm

Also, similar issue with the timer. Since more than one can timeout at the same time, you need to cycle through them.
www.blackhornettechnologies.com/Constru ... t_BHT.capx
ImageImageImage
B
71
S
22
G
248
Posts: 3,761
Reputation: 138,073

Post » Sat Feb 06, 2016 7:39 pm

Yes, it is the timer which is the problem, and I can see why now. Thanks a lot!
B
26
S
9
G
2
Posts: 78
Reputation: 2,524

Post » Sat Feb 06, 2016 7:42 pm

blackhornet wrote:Also, similar issue with the timer. Since more than one can timeout at the same time, you need to cycle through them.
http://www.blackhornettechnologies.com/ ... t_BHT.capx


Oh man. More work arounds.
Last edited by megatronx on Sun Feb 07, 2016 1:08 am, edited 1 time in total.
My professional Royalty Free Music at Scirra Assets Store
--------------------------------
Specs: i5 2500, 16gb of ram, gtx 770, win 7, Focusrite Scarlett 8i6, Mackie mr8mk2, Alesis 320, browsing the net on chrome.
B
91
S
30
G
22
Posts: 1,985
Reputation: 20,149

Post » Sun Feb 07, 2016 12:22 am

Isn't it correct that triggered events (contrary to std. events), are triggered immediately by a single object instance? I thought that if multiple triggered events fire (semi)simultaneously, they would be handled like a stack in programming. In other words, instance filtering wouldn't be necessary in triggered events. Of course the triggered timer event suggests I'm wrong, but @megatronx comment confuses me a little, as I had problems with timers around a year ago, and started using my own, until a couple of weeks ago.

For example in my code from above - the block where I use the triggered collision event. I'd expect that if multiple sprite3 collided with sprite2, a stack of triggered events was created, and not one triggered event where I had to filter instances. Is this wrongly understood? Because it seem to work as is:
Image

---

The std. overlap event would also result in correct behavior according to my original goal, if modified as follows to filter instances:
Image
B
26
S
9
G
2
Posts: 78
Reputation: 2,524

Post » Sun Feb 07, 2016 1:08 am

I'm confused now too.
My professional Royalty Free Music at Scirra Assets Store
--------------------------------
Specs: i5 2500, 16gb of ram, gtx 770, win 7, Focusrite Scarlett 8i6, Mackie mr8mk2, Alesis 320, browsing the net on chrome.
B
91
S
30
G
22
Posts: 1,985
Reputation: 20,149

Post » Sun Feb 07, 2016 1:13 am

Manual:
On timer
Triggers either regularly, or once off, after a timer that was started with the same tag has reached its duration. NOTE: this trigger can fire with multiple instances picked, if their timers all reach their time in the same tick. This can sometimes work unexpectedly if the actions expect there to be just one instance picked. The workaround is to add a For each condition after this trigger to ensure the actions run once per instance.
ImageImageImage
B
71
S
22
G
248
Posts: 3,761
Reputation: 138,073

Post » Sun Feb 07, 2016 1:25 am

blackhornet wrote:Manual:
On timer
Triggers either regularly, or once off, after a timer that was started with the same tag has reached its duration. NOTE: this trigger can fire with multiple instances picked, if their timers all reach their time in the same tick. This can sometimes work unexpectedly if the actions expect there to be just one instance picked. The workaround is to add a For each condition after this trigger to ensure the actions run once per instance.


It might be because of late hour here, but in this case, then there's has to be another condition that will lock out those that are not meeting the timer condition, right?
Let's say you want to destroy object on timer. Number of them triggers simultaneously. What would you do to avoid destroying all objects (because of For each condition)? And now I know what was causing those random issues in my projects. And I wasn't expect this to be it, since it is counter intuitive.

@Ashley Hope that it is going to be fixed in c3, with stacking up objects.
My professional Royalty Free Music at Scirra Assets Store
--------------------------------
Specs: i5 2500, 16gb of ram, gtx 770, win 7, Focusrite Scarlett 8i6, Mackie mr8mk2, Alesis 320, browsing the net on chrome.
B
91
S
30
G
22
Posts: 1,985
Reputation: 20,149

Next

Return to Construct 2 General

Who is online

Users browsing this forum: No registered users and 11 guests