==============
Rotation Effect
==============
Created by MaximilianJenus

;---------------------------------------------------------------------------
Rotation Effect -- This can be used for various purposes,
such as Spiral's knives, or Strider's Oroboros.

This simply shows the basic equations required to create
the rotation effect.
;---------------------------------------------------------------------------

[StateDef 9000]
etc...

;---------------------------------------------------------------------------
1.) This VAR indicates the helper's location relative to its parent. (angle)

[State 9000, VarSet]
type = VarSet
trigger1 = Time = 0 ;Adjust as you wish.
fv = 0
value = 0

0 radians in case you are using multiple helpers (eg, Spiral's knives)
you can use the following expresion:

value = IfElse(p1name="helper1",0,pi)

Where "helper1" is the name of the current active helper.

You can "nest" more IfElse expresions, for more helpers. Obviously, giving every 
helper a diferent name on the helper calling state.

;---------------------------------------------------------------------------
2.) This VAR is the rotation speed (So, you will be able to accelerate, or decelerate
the rotation ratio.)

[State 9000, VarSet]
type = VarSet
trigger1 = Time = 0 ;Adjust as you wish.
fv = 1
value = .2

-The value is given on radians. You can increase the speed by using other VarSet
or expresions, like:

value = (time/60)+1 ;This makes the rotation, accelerate even more as time passes.

-Or, as used on Yoshi...

value = IfElse((Time/180)%2,-.2,.2) ;This makes the direction of the rotation
change from clockwise to counterclockwise every 3 seconds.

;---------------------------------------------------------------------------
3.) This is the Y stretch of the move,in case you don't want a perfect circle. (Oval shaped effect.)
[State 9000, VarSet]
type = VarSet
trigger1 = 1
fv = 2
value = 1 ;Can be .5, .2, or even an expresion.

;This is the X stretch of the move.
[State 9000, VarSet]
type = VarSet
trigger1 = 1
fv = 3
value = 1

What's the use of vars here? Well, you can make the stretch change over time,
or when certain conditions are met. You are not going to change their value,
then better use constant numerical values. (eg. 3, .5, etc..)

;---------------------------------------------------------------------------
4.) Pos setting routine, and drawing:

;This adds the angle to the current one
[State 9000, VarAdd]
type = VarAdd
trigger1 = Time > 0 ;Adjust as you wish.
fv = 0
value = FVar(1)

;This sets the helper's position, relative to its parent.
[State 9000, BindToParent]
type = BindToParent
trigger1 = 1
facing = 1
time = 1
pos = Cos(FVar(0)) *FVar(3), Sin(FVar(0)*FVar(2)

The "Pos" equation is the basic concept, but won't look very good.
But if we were to use this instead:

pos = Cos(FVar(0)) *FVar(3),(-Sin(FVar(0)-(size.mid.pos.y/2))*FVar(3)

The helper rotates around half the player's height.

;Just in case you want the helper to spin itself as well:
[State 9000, AngleSet]
type = AngleSet
trigger1 = 1
Value = FVar(0)*2pi ;Angle must be given on degrees.

[State 9000, AngleDraw]
type = AngleDraw
trigger1 = 1

Use this IF you want the helper to be shown behind, then on front of the parent.
In this case, on half of the rotating move, the helper will be on top of the parent,
and the other half it will be behind.

[State 9000, SprPriority]
type = SprPriority
trigger1 = 1
value = IfElse((Fvar(0)/Pi)%2,3,-1)

;Use this to release the helper, in case you need to..
[State 9000, ChangeState]
type = Changestate
trigger1 = Parent, Command = "release"
value = 9001

In state 9001, it can be anything that you make the helper do, so I'll leave you at that. =)
