How do I create an object at the offset of the last object?

Get help using Construct 2

Post » Mon May 18, 2015 12:55 pm

Say I have an object, and I want to use one expression to say, "Create Object / Set X to +8 of last created object", and then repeat that 20 times with the one line and the repeat condition. Currently the objects just spawn on top of each other instead of to the right of the last created object.

It seems simple enough, and maybe i'm just tired, but my workaround involves 20 lines in a function that just creates 20 objects at a new X value for each. i.e. ( Create Object / Set X =40, Create Object / Set X = 48, etc,

So this simple expression would remove this function call, and about 25 lines!! Thank you guys!
B
8
S
1
Posts: 28
Reputation: 906

Post » Mon May 18, 2015 1:17 pm

You could use local variables and do something like this:

VariableForX = 40
VariableForY = 100
repeat 20 times
- system create object at x= variableforx y = variableforY
- system add 8 to variableforx
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Mon May 18, 2015 1:24 pm

B
66
S
24
G
7
Posts: 1,513
Reputation: 11,037

Post » Mon May 18, 2015 1:50 pm

Thank you fellas, I don't know why I didn't consider using "loopindex", thanks a lot!! Just reduced that nasty function call to one line! Bravo!
B
8
S
1
Posts: 28
Reputation: 906


Return to How do I....?

Who is online

Users browsing this forum: Artcadev, MaxxMunnn, Uk4dee and 17 guests