Z movement(elevation) for the Sine Behavior

This forum is currently in read-only mode.
From the Asset Store
Skin it
$14 USD
30% off
A skin plugin and behavior to add a skin system in your game.
  • You know what I mean (sorry for the short text - I hate writing)

  • This is a great request and all which I'd personally like to see, but shouldn't this really be on the 'Feature requests' board?

  • In the meantime, put a dummy sprite offscreen with a y value of 0 and give it the Sine behaviour with vertical movement..

    Then just

    Always - set Z elevation (of main sprite) to dummy sprite.y

    Krush.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • + System: Sprite.Value('num')%2 Equal to 0

    -> Sprite: Set Z elevation to Sprite.ZElevation+1

    + System: Else

    -> Sprite: Set Z elevation to Sprite.ZElevation-1

    + System: Every 5000 milliseconds

    -> Sprite: Add 1 to 'num'

    3 events with a private variable

  • newt that would make a saw wave?

    set sprite z elevation to:

    sin((timer+{offset})*{period scaler})*{range}

    this has pretty much everything you need to do what the sine movement does in its entirety. randomizations require a second step, but first let me explain the different {fancy bracket stuff}

    those are all adjustable parameters.

    offset, will be a number from 0-359 anything higher or lower will just make it harder to read because of loop-back in the phase.

    <img src="http://hobohome.com/news/wp-content/uploads/2009/10/sinewave.gif">

    this parameter will act like the offset in the sine behavior, except its not in percentage.

    if you wanna know how much of a percentage of offset it is, simply check what your desired offset over 360 is. like an offset of 90, would be 90/360=1/4= 25% i assume your smart enough to figure out what a desired percentage would be (cross multiply some stuff i dont feel like explaining it its simple math)

    the {period scaler} adjusts the length of the period. i think timer is always gonna be running at millisecond speed. so it normally takes 360 milliseconds to complete a full period (again all has to do with sine phase) if you have a period scaler of .5 itll take 720 milliseconds, because itll be half as slow, and of course a scaler of 2 will take 180 milliseconds. if you wanna have an exact amount of time

    i think you would have to do this to get it

    desired length in millisecs/360

    and use that as the period scaler parameter

    range parameter is simply, well... range.

    if you wanna randomize things, use private variables for each of the parameters, and at startup

    add a random(x) to the desired starting value.

    thats pretty much all you need to know to mimic sine behavior, its really not all that complicated if you know what you're doing.

  • This is a great request and all which I'd personally like to see, but shouldn't this really be on the 'Feature requests' board?

    Yes it should... moving thread.

  • newt that would make a saw wave?

    Nope it makes a sine, its the same speed going up as it is going down.

    What it is is a simple toggle, simple to implement, and simple to understand.

    btw you might post an example of your formula in action... I assume your smart enough to figure that out.

  • sine isnt same speed going up as it is going down thats a triangle wave. sine is the length of the vertical side of a right triangle with hypotenuse of length 1 at an angle X.

    heres an example, tracing an ellipse through 3d space with a combination of my technique for sine movement through Z elevation (or any parameter) and a real sine behavior for the y movement.

    http://dl.dropbox.com/u/1010927/zsinemov.cap

    i made a mistake in my post its 360/milliseconds.

  • Yeah, and that would be really noticeable if it were on the x, or y axis.

    Also I guess somebody should mention that an addition to the sine behavior probably wont happen, since z(currently) is a sprite object dimension. It is the only object set up for it.

    Not that you couldn't fake it for other objects.

  • Also I guess somebody should mention that an addition to the sine behavior probably wont happen, since z(currently) is a sprite object dimension. It is the only object set up for it.

    Not that you couldn't fake it for other objects.

    The SDK allows you to set the Z-elevation of any object, but it's up to the plugin developer to actually draw the objects with Z-elevation. Since the sprite is the object most commonly used with this behavior, it would be a helpful feature addition.

  • Actually, I've wanted to use Sine behavior with a jillion different things.

    I just wish I could get the value out of it with an expression.

    Then you'd just set Z to it. Or an effect parameter or whatever you wish.

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