Assign Variable in loops

Get help using Construct 2

Post » Sun Apr 07, 2013 2:29 am

Hey everyone ,

I'm making some complicated stuff with lerp and such and I got to a wall ...



In the pic you just saw ... I'm spawning some Solidblocks , and assigning them some variables for a lerp event I didn't list in the pic ...

But it's basically ,
If Lerp = 1 , then lerp to targetX and targetY

Theorically it should work ...

But here , it doesn't , all because of the wait 0 seconds

Let me explain , here the wait 0 seconds waits until the object is created successfully but also breaks the variable events because the loop produces in one tick and spawning the objects takes 1 tick , meaning curX and CurY aren't assigned and they don't change (0,0) (the loop is finished just at the same tick as the object is successfully created) and removing it also breaks the variable events because there's no picked object to assign a variable to ...

What does happen ?
The solid block lerps to 0,0 and stop

I'm in a sandwitch , ye know ...

Halp ! ;(Whiteclaws2013-04-07 02:41:08
B
35
S
16
G
16
Posts: 2,222
Reputation: 16,589

Post » Sun Apr 07, 2013 7:41 am

Remove wait 0, it should work. I'd guess your problem is somewhere else.
B
24
S
8
G
7
Posts: 756
Reputation: 7,192

Post » Sun Apr 07, 2013 2:10 pm

@vee41 , no it didn't ... want to see the capx ?

If yes , send me a pm ...
B
35
S
16
G
16
Posts: 2,222
Reputation: 16,589

Post » Sun Apr 07, 2013 4:50 pm

@vee41 , the boxes aren't even spawned

If you need the capx ... I can send it to you
B
35
S
16
G
16
Posts: 2,222
Reputation: 16,589

Post » Sun Apr 07, 2013 4:59 pm

If you could isolate the bad behaviour into a separate CAPX, then anyone could investigate the base issue.
ImageImageImage
B
67
S
19
G
122
Posts: 3,207
Reputation: 73,401

Post » Sun Apr 07, 2013 5:41 pm

@Blackhornet, there's a whole level loading algorithm behind and this feature depends on the algorithm ...
B
35
S
16
G
16
Posts: 2,222
Reputation: 16,589

Post » Mon Apr 08, 2013 7:01 am

[QUOTE=Whiteclaws]there's a whole level loading algorithm behind and this feature depends on the algorithm ...[/QUOTE]

Just do a lot of debug texts, check for variable values at every point and see where the flaw in logic is. In theory it should work, you can set variables inside a loop after creating an object. What you cannot do is refer to it before next top level event.
B
24
S
8
G
7
Posts: 756
Reputation: 7,192


Return to How do I....?

Who is online

Users browsing this forum: Axiomaltd, jeffige and 25 guests