Picking fails without long wait signals - why?

Get help using Construct 2

Post » Sun Jun 30, 2013 1:01 am

Hi,

I'm at loss with the C2 picking system. Or rather, I'm not even sure where the problem might be.

I'm generating a grid of blue dots. Then the grid is overlaid with symbols, and a dot is removed after it is replaced with symbol. Then, an overlay object [large yellow rect] is positioned over the symbol, to detect any nearby dots (not yet replaced with symbols), and the next symbol is generated over one of the nearby dots (randomly picked).

The problem is, that unless I add plenty of "wait" signals, to slow it all down, the whole thing does not work! And I'm on a quad core, so it will be a disaster on a slower machine.

Please see the capx file: if you disable some or all "wait" signals, some or all of the round symbols will start overlapping each other, while they are not allowed to do so. It will differ from run to run, and gets worse with WebGL=Off.

I will be grateful for help with this problem - I spent last 12 or so hours trying to figure out what I'm doing wrong.

http://gkrol.info.pl/c2/TrailTest.capx

Thanks,
Greg
B
18
S
3
G
3
Posts: 82
Reputation: 3,734

Post » Sun Jun 30, 2013 4:22 am

I have looked at your program, and im not really sure I understand what you are trying to do. But I think you suffer from the same problem as some of us also have experienced. Which I still find a bit confusing, as it seem a bit weird that sometimes it works and sometimes it doesn't.

Personally I try as much as possible to avoid using "system create object" in functions all together. because of them not being available as I understand it before next top level, and it seem to cause a lot more problems than its worth.


But if I understood you correct, I would change the program in such way, that you start by spawning all the blue dots in the start of layout. And then make an variable like "Blue_dots_spawned = 0". Then add an event that will trigger on "Blue_dots_spawned = 0" and in that event you set it to 1, so it doesn't trigger again. Also in that event, you can use a for each "Blue dot" and then do what you have to do in the event it self, or add a function call here, that can pass the UID of the blue dot, and do it in a function instead, if you prefer that.

Now instead of using "System create object" to spawn the symbols make the current blue dot spawn them instead, and then destroy that blue dot afterwards. Then have symbol spawn the large yellow object, and add a if "yellow object overlapping blue dot" As you have already destroyed blue dots, that have symbols you will never select them. And then you can just add a pick random afterwards, and it will select a random blue dot, from those conditions. And then you can do whatever you want with that blue dot.

Hope you understand what I mean :Dnimos1002013-06-30 04:24:22
B
44
S
11
G
2
Posts: 1,181
Reputation: 6,826

Post » Sun Jun 30, 2013 9:57 am

Thanks, @nimos100

[Edited]
I have tried your suggestion. Replacing system.create with spawn resolved the problem, it seems :-)

Btw, the blue dots and yellow rectangle in my project are just helper objects - I aimed to generate a "connect-consecutive-numbers" type of layout, making sure that each next number stays close to the previous one.

Cheers,
GregCJK2013-06-30 10:12:26
B
18
S
3
G
3
Posts: 82
Reputation: 3,734


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 3 guests