Enemy mirrored on Sine Behavior

Attached Files

The following files have been attached to this tutorial:

.capx

sinemirrored.capx

Download now 171 KB

Stats

1,461 visits, 2,241 views

Translations

This tutorial hasn't been translated.

Tools

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 KB
  • 0 Comments

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