Dim nExpectCount
Sub Player_OnControllerMove(OldActions, NewActions)
With ProjectObj.GamePlayer.PlayerSprite
If (Not OldActions) And NewActions And ACTION_BUTTON1 Then
If (.rDef.SolidTest(.X, .Y + .Height) Or .rDef.SolidTest(.X + .Width - 1, .Y + .Height)) Or (Not .pRideOnRef Is Nothing) Then
.DY = - .rDef.Template.JumpHeight
End If
End If
End With
End Sub
Sub RecountShots()
Dim nSIdx, nLIdx
With ProjectObj.GamePlayer.PlayerSprite.rDef.rLayer
nExpectCount = .SpriteCount
End With
End Sub
Sub RemoveShot(Spr)
Dim nIdx
With ProjectObj.GamePlayer.PlayerSprite.rDef.rLayer
For nIdx = 0 to .SpriteCount - 1
If .Sprite(nIdx) Is Spr Then .RemoveSprite(nIdx) : Exit Sub
Next
End With
End Sub
Function GetStateDeltas(DX, DY)
With ProjectObj.GamePlayer.PlayerSprite
Select Case .rDef.Template.StateType
Case STATE_SINGLE
If Abs(DX) + Abs(DY) > 1 Then
DX = .DX / (Abs(.DX) + Abs(.DY))
DY = .DY / (Abs(.DX) + Abs(.DY))
Else
If Abs(DX) + Abs(DY) < 1 Then DX = 0 : DY = -1
End If
Case STATE_LEFT_RIGHT
DY = 0
If (.CurState Mod 2) = 0 Then DX = -1 Else DX = 1
Case STATE_8_DIRECTION
Select Case (.CurState Mod

Case 0 : DX = 0 : DY = -1
Case 1 : DX = 1 : DY = -1
Case 2 : DX = 1 : DY = 0
Case 3 : DX = 1 : DY = 1
Case 4 : DX = 0 : DY = 1
Case 5 : DX = -1 : DY = 1
Case 6 : DX = -1 : DY = 0
Case 7 : DX = -1 : DY = -1
End Select
Case Else
DX = Cos((.CurState Mod 36) * 3.14159 / 18)
DY = -Sin((.CurState Mod 36) * 3.14159 / 18)
End Select
End With
End Function
Sub Player_OnAfterMoveSprites
Dim nIdx, VLeft, VTop, VRight, VBottom, VDat
With ProjectObj.GamePlayer
VLeft = .MapScrollX
VTop = .MapScrollY
VRight = VLeft + .rMap.ViewWidth
VBottom = VTop + .rMap.ViewHeight
End With
End Sub
Function RectToPolarState(X, Y)
Dim Angle, Pi
Pi = 3.14159
If X <> 0 Then
Angle = Atn(-Y / X)
Else
Angle = -(Pi / 2) * Sgn(Y)
End If
If X < 0 Then
Angle = Pi + Angle
ElseIf Y > 0 Then
Angle = Pi * 2 + Angle
End If
RectToPolarState = ((Angle * 18) / Pi) Mod 36
End Function
'_______________my script_________________________________________
Sub Player_OnControllerMove(OldActions, NewActions)
dim AngleRadians
With ProjectObj.GamePlayer
Target.X = ninja.X + Cos(AngleRadians) * 100
Target.Y = ninja.Y - Sin(AngleRadians) * 100
if ACTION_BUTTON3 then AngleRadians = AngleRadians + 3.14159265 / 18
end with
end sub
'_________________________________________________________
HostObj.SinkObjectEvents ProjectObj.GamePlayer, "Player"
HostObj.ConnectEventsNow()
ProjectObj.GamePlayer.Play 16
whoops... that not script button, anyway it says that ninja doen't exsist... BUT HE DOES!!!