sprite once created doesn't find path

Get help using Construct 2

Post » Thu Jul 14, 2016 3:48 am

I have a function, StartRoc()-called by StartGame(), that creates a Roc, changes animation, and sends it to the other board. In reality, it creates the Roc, and the Roc just sits there. It should be pretty straightforward, not sure what the problem is.

https://www.dropbox.com/s/0e14dnd4wgb0efn/Uru.capx?dl=0
B
16
S
7
Posts: 46
Reputation: 1,344

Post » Thu Jul 14, 2016 7:53 am

Is the Roc you talk about created in event 49 ?
B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950

Post » Thu Jul 14, 2016 8:01 am

Try add a "wait 0" action before calculate path and see if it helps. Could be that it's related to this issue. https://www.scirra.com/forum/pick-all-create-bug_t178366

Once created it doesn't really exist until next tick, but not sure.. if wait 0 works, it's the same problem.
Follow my progress on Twitter
or in this thread Archer Devlog
B
43
S
18
G
19
Posts: 1,065
Reputation: 14,089

Post » Fri Jul 15, 2016 2:03 am

99Instances2Go wrote:Is the Roc you talk about created in event 49 ?


That's the one.
B
16
S
7
Posts: 46
Reputation: 1,344

Post » Fri Jul 15, 2016 3:12 am

tunepunk wrote:Try add a "wait 0" action before calculate path and see if it helps. Could be that it's related to this issue. https://www.scirra.com/forum/pick-all-create-bug_t178366

Once created it doesn't really exist until next tick, but not sure.. if wait 0 works, it's the same problem.


I put a wait 0, and it did nothing. However, when I disable set animation, I get the movement across the screen. It's only one sprite, it's not I'm creating a bunch of them.
B
16
S
7
Posts: 46
Reputation: 1,344

Post » Fri Jul 15, 2016 9:25 am

This is a simple model of the method you use.
https://drive.google.com/open?id=0B1SSu ... kRqa3k5ems

That works flawless, as you see. So, your model is correct.
Look at the variable pathsFound, it adds 1 to it each time a path is found.

Now, look at your capx.
https://drive.google.com/open?id=0B1SSu ... TFCb2RfLVk

I added the same variable (this time called 'PATH'). You can see it in a text box in the right corner.
Notice that is runs like crazy.

Or, kinda EACH tick it finds a path. And before it can move, it finds again a new path.
I would solve this for you, but you have so many events that force the Roc to find a path that it is kinda impossible. I dont know/understand your game logic.

So, some where in all those events, there is 1 or more events that is/are almost always true, forcing the Roc to find a new path almost every tick. It does not have the time to move on the path before it again gets a new path.

I gave you the tools (this variable) to debug that yourself. I also placed markers on each node of the found path.
B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950

Post » Fri Jul 15, 2016 11:35 am

I opened your link, but I don't see the .capx.
B
16
S
7
Posts: 46
Reputation: 1,344

Post » Fri Jul 15, 2016 2:21 pm

You can download the capx by clicking the download button in the black bar at the top of the page :)
B
13
S
6
Posts: 130
Reputation: 1,553


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 10 guests