Change to random Sine Wave?

Get help using Construct 2

Post » Thu May 30, 2013 9:46 pm

Hi,

How would you make an object, upon reaching a certain condition(for example, on reaching max magnitude), change it's sine wave type to another, random one? (Sine,Square,Triangle,Sawtooth)Xionor2013-05-30 21:50:58
B
10
S
3
Posts: 233
Reputation: 1,537

Post » Thu May 30, 2013 9:56 pm

I think you can do this:
Create an instance variable for the object, "SineType" or whatever.

Create some events to change the sine type depending on that variable,
Object.SineType=1 ----->Sine
Object.SineType=2 ----->Square
Object.SineType=3 ----->Triangle
Object.SineType=4 ----->Sawtooth

Then,

Condition-----> Set Object.sinetype((rnum(1,4))

Something like that.

Edit: Actually I think it would be Object.sinetype(floor(random(1,5))pseudotropheus2013-05-30 22:01:03
B
16
S
3
Posts: 24
Reputation: 859

Post » Thu May 30, 2013 10:00 pm

Well yes, that's the logic.

But how do you set the value of "SineType"?

System only lets you set global variables whereas the Objects "menu" only lets you pick a certain Sine Type from a drop-down menu.Xionor2013-05-30 22:00:28
B
10
S
3
Posts: 233
Reputation: 1,537

Post » Thu May 30, 2013 10:02 pm

In the layout, select your object. In the properties menu on the left, click on instance variables and add the SineType variable there.

Then, you can access the value as Object.SineType.
B
16
S
3
Posts: 24
Reputation: 859


Return to How do I....?

Who is online

Users browsing this forum: KittenKatja, MAVERICK, QuantumMMX, Zion and 11 guests