Reverse the sine behavior?

0 favourites
  • 7 posts
  • I wanted to implement an effect where my swaying grass would be pushed by the player moving past it. My test works perfectly when they're moving in the same direction, but if the grass is swaying left while you pass it going right, well, I want to make it reverse direction and start swaying right.

    I can't seem to find a way to do that, unless I'm overlooking something right under my nose. <img src="smileys/smiley5.gif" border="0" align="middle" /> Anyone know something I don't?

  • I'm not sure if this is possible, but maybe you can set the magnitude of sine to a negative number, or have a second sine behavior set to a negative number and switch between them when the player comes in overlaps with the grass?

  • That looked like it was going to work at first, but turns out it doesn't... Unless it switches sine behaviors when it's in the starting position (completely upright, no sway), the new behavior picks whatever position it IS at to be it's OWN starting position... which makes it get all out of whack if you have any idea what I'm saying.

    The easiest solution would be for a "Reverse Sine" button... *coughcough Ashley coughcough* <img src="smileys/smiley2.gif" border="0" align="middle" />

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • haha that's nasty but I'll post it anyway

    Have no idea what and when it was made but, well..

    looled grass

  • Haha well that's a interesting... style of grass. <img src="smileys/smiley36.gif" border="0" align="middle" /> I might have to do something similar with manually controlling the angles though if reversing it isn't an option.

  • I'd just create my own sine behavior. Or, at least use 'value only' and apply it to the angle using your own method which allows this.

  • That's what I've been figuring, but... will there be a performance difference? I mean, I use a LOT of grass. A stupid amount, really. The level I'm working on isn't even half done and there's 208 grass sprites. I'll eventually put in options to turn off certain effects, probably replacing the individual sprites with static tiled backgrounds, so I guess it's not a huge deal.

    But in the same way the particle system is more efficient than you spawning the sprites yourself, is the sine behavior more efficient than manually rotating all the grass (maybe 30-40 on screen at once)?

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