YesNoOk
avatar

AngleDraw with rotation point offset (Read 8759 times)

Started by GamerXP, April 14, 2011, 04:35:08 pm
Share this topic:
AngleDraw with rotation point offset
#1  April 14, 2011, 04:35:08 pm
  • *
    • Russia
Made few days ago code that will help to move rotation point of angle draw. Usually, its center of sprite, but with this you can move it FROM the center to some other point. It can be useful for custom damage states, that won't use Sprite Standarts or so

Code:
[State 0, Offset]
type = Offset
trigger1 =
x = (-x_offset*cos(angle*pi/180)-y_offset*sin(angle*pi/180)+x_offset)*facing
y = x_offset*sin(angle*pi/180)-y_offset*cos(angle*pi/180)+y_offset

[State 0, AngleDraw]
type = AngleDraw
trigger1 =
value = angle

Example, moving rotation point up on 35 pixels:

Code:
[State 0, Offset]
type = Offset
trigger1 = 1
x = (35*sin(time*pi/180))*facing
y = 35*cos(time*pi/180)-35

[State 0, AngleDraw]
type = AngleDraw
trigger1 = 1
value = time

As you can see, there is no x_offset so I just removed it. Also, notice, that offset up is negative var so minuses got removed