How do I uniformly use expressions to set properties?

Get help using Construct 2

Post » Fri Jul 04, 2014 4:19 pm

I'm finding that I often want to set the properties of an instance with an expression. And while some actions allow expressions as input, some do not. Some only allow numbers or only offer an either/or for a boolean. I'm finding this hard to work with in many cases.

For example, I have a collection of instances that I want to loop through and randomly set their flip property. If I could use an expression, it would be as simple as using a "for each" condition connected to a "set flipped" action of "floor(random(2))". But the "set flipped" action only offers a drop-down selector of flipped or not flipped. And to use that, it seems like I would need a much more complex arrangement.

Is there any way to simply set it with an expression?

Failing that, is there a simple way to accomplish the above that I'm missing? (The best I've found is to call a function with the IID and use a global variable to store the random and compare to that to set it.)

Thanks!
B
8
S
2
Posts: 55
Reputation: 616

Post » Thu Jul 31, 2014 6:48 pm

YES me too! I end up making a function that takes an expression and does that. It would also be nice for doing boolean math that way too like "X=X-(object.mirrored)" or something.
Follow my CZero development on twitter https://twitter.com/CaptainZeroGame
B
62
S
17
G
5
Posts: 171
Reputation: 8,329


Return to How do I....?

Who is online

Users browsing this forum: unxcellent and 4 guests