sine effect

0 favourites
  • 6 posts
From the Asset Store
A total of 214 high quality and unique magic sound effects suitable for RPG, Battle Arena and more!
  • Using the sine effect, is there a way to have the horizontal movement go forward a certain amount and the go back?

    In other words, without any special commands, the sine effect moves my sprite back and forth horizontally. Unfortunatley, in moves it back and forth the same distance forward and backward.

    Can I set sine so that it moves forward a certain amount and moves backwards a different amount?

    What I'm getting at is that I want a sprite to "peek" out behind another sprite. It moves forward and "peeks" out fine but then it sways in the other direction "peeking" out the other side.

    I just want it to "peek" out in the forward direction and then move back behind the other sprite.

  • You could use the sprite's current position to calculate when it's at the peak or trough of the sine wave, and change the sine behavior's amplitude at that time.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Or you can make the peaking sprite invisible when it's going too far? Or just adjust the normal position of the moving sprite? there are quite many ways to make this happen. It'll depend on what the situation is.

  • the problem is spriteA is only as big as too hide the main sprite so that the sine effect peeks out the front and the back. I was hoping I could put some kind of restriction on the sine effect to prevent it from showing on the other side of the main sprite.

    Making it invisible alters the effect I was going for. I want to have the main sprite slide out from behind another sprite.

    I'm sure there are many ways to get this effect but I was just trying with the sine effect. I basically just wanted the main sprite to peek out a ways and then go back to it's position hidden behind spriteA

    Maybe sine is not the best option

  • The point is, you can just query the sine behavior to find out when you are behind the sprite, then change the sine behavior to not come out the other side.

    For example, let's say both sprites start at the same spot. Start the sine behavior, sprite peaks out, comes back, but before it has a chance to peak out the other side, you alter the parameters of the sine behavior to prevent that.

    More specifically, you can use the CyclePosition expression to know when you are mid-way through the cycle (this is the point after you've peaked out and come back), and when that happens do things like enable and disable the sine behavior (this may re-start it I'm not sure), change the magnitude to 0, or manually re-set the sprite position to the correct place every frame until CyclePosition is again on the 'peaking' side of the sine wave.

  • Thanks for the reply. I'll have to try that and see how it works out.

    I did come up with a different solution tho I'm not too crazy about it.

    after the sine movement in the front, I set a time to turn on opacity.

    It seems to be enough time to peek the sprite in the front and then right before coming out the back, it disappears.

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