How do I make a function's parameter the object for an...

Get help using Construct 2

Post » Tue Oct 14, 2014 9:15 pm

How do I make a function's parameter the object for an instanced variable?

So basically what I'm trying to do is "(Function.Param(0)).FlipDown"

(FlipDown being the instanced variable in the object named by "Function.Param(0)" )

Is it even possible to name an object using the Function.Param(0)? Can I do it through global variables? Thanks, if you need more details, ask.
B
4
Posts: 4
Reputation: 204

Post » Tue Oct 14, 2014 9:25 pm

I think the way to do this is to pass the uid of the object as a parameter, then pick the object back, so you can use the instance variables.
Game design is all about decomposing the core of your game so it becomes simple instructions.
B
53
S
22
G
18
Posts: 2,122
Reputation: 17,123

Post » Tue Oct 14, 2014 9:26 pm

Aphrodite wrote:I think the way to do this is to pass the uid of the object as a parameter, then pick the object back, so you can use the instance variables.

How would I go about doing this?
B
4
Posts: 4
Reputation: 204

Post » Tue Oct 14, 2014 10:19 pm

Function:Call "myfunc" (Sprite.UID)

------------- <>8 ----------

Function: On "myfunc"
Sprite: Pick instance with UID (Function.param(0)) -->> do something with Sprite.FlipDown

This technique is limited (but necessary) because you need to know the object type to pick it. You can get somewhat generic by using a Family (C2 full version).
B
24
S
9
G
4
Posts: 1,646
Reputation: 6,596


Return to How do I....?

Who is online

Users browsing this forum: MassimoF and 28 guests