Enemy mirrored on Sine Behavior

5

Attached Files

The following files have been attached to this tutorial:

.capx

sinemirrored.capx

Download now 171.88 KB

Stats

4,305 visits, 6,247 views

Tools

Translations

This tutorial hasn't been translated.

License

This tutorial is licensed under CC BY 4.0. Please refer to the license text if you wish to reuse, share or remix the content contained within this tutorial.

Published on 25 Jul, 2015. Last updated 19 Feb, 2019

Hello,

I've seen people ask how to use the mirror action with sine behavior. This is useful for use with enemies if we want them to patrol an area using the sine behavior.

I found a simple way using the "Value" property of the sine behavior.

The Value property works like this:

Suppose we want a magnitude: 50 (you can choose any value). Then the sprite will go from 0 to 50 and when it arrives 50, it will return back to reach -50.

And that's the Value, go from "-Magnitud" to "+ Magnitude":

Applying this, there is a simple way to make the mirror.

When "Value" is greater or equal to "-1 magnitude (ie, 49)" then it will mirror.

When "Value" is less or equal "- magnitude +1 (ie, -49)" then will mirror.

This is the result:

I hope you find it useful.

Here is the example .capx ;)

.CAPX

sinemirrored.capx

Download now 171.88 KB
  • 1 Comments

  • Order by
Want to leave a comment? Login or Register an account!