Change to random Sine Wave?

0 favourites
  • 4 posts
From the Asset Store
Two levels with two sistem Wave. with Source-code (.c3p) + HTML5 Exported.
  • 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)

  • 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))

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • 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.

  • 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.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)