0% found this document useful (0 votes)
23 views5 pages

Tails Idle Animation Script

This script controls the animation and drawing of Tails as an object following Sonic in Sonic CD. It defines aliases for animation states and priorities. The main sub handles drawing Tails in the correct animation state and position relative to Sonic. On startup, it loads the Tails sprite sheet and defines the idle, rolling, and jumping animation frames.

Uploaded by

Lucas Da Web95
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
23 views5 pages

Tails Idle Animation Script

This script controls the animation and drawing of Tails as an object following Sonic in Sonic CD. It defines aliases for animation states and priorities. The main sub handles drawing Tails in the correct animation state and position relative to Sonic. On startup, it loads the Tails sprite sheet and defines the idle, rolling, and jumping animation frames.

Uploaded by

Lucas Da Web95
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd

//----------------Sonic CD Tails Object Script----------------//

//--------Scripted by Christian Whitehead 'The Taxman'--------//


//-------Unpacked By Rubberduckycooly's Script Unpacker-------//

// Aliases
#alias Object.Value1 : [Link]
#alias Object[1].DrawOrder : [Link]
#alias Object[1].Priority : [Link]

#alias 1 : PRIORITY_ACTIVE

// Animations
// Neither the decomp or steam support using animation values in a switch case, so
these aliases will have to do the work
// if you ever mod tails animation file, just make sure these aliases match the
animation values they're supposed to be
#alias 0 : TAILS_STOPPED
#alias 1 : TAILS_WAITING
#alias 3 : TAILS_LOOKING_UP
#alias 4 : TAILS_LOOKING_DOWN
#alias 7 : TAILS_SKIDDING
#alias 9 : TAILS_SPIN_DASH
#alias 10 : TAILS_JUMPING
#alias 17 : TAILS_PUSHING
#alias 43 : TAILS_ROLL3D

// Player aliases
#alias 1 : PLAYER_TAILS

sub ObjectMain
ArrayPos0 = [Link]
Screen[ArrayPos0].DrawListSize = 2
GetDrawListEntityRef(TempValue0, ArrayPos0, 0)
SetDrawListEntityRef([Link], ArrayPos0, 0)
SetDrawListEntityRef(TempValue0, ArrayPos0, 1)
end sub

sub ObjectDraw
if [Link] != [Link]
if [Link] > 4
[Link] = 0
end if

if [Link] > 4
[Link] = 0
end if

[Link] = [Link]
end if

[Link] = [Link]
switch [Link]
case TAILS_STOPPED
if [Link] == 0
TempValue0 = [Link]
TempValue0 >>= 3
if [Link] == true
DrawSpriteFX(TempValue0, FX_FLIP, [Link], [Link])
end if

[Link]++
[Link] %= 40
end if
break

case TAILS_WAITING
case TAILS_LOOKING_UP
case TAILS_LOOKING_DOWN
TempValue0 = [Link]
TempValue0 >>= 3

if [Link] == true
DrawSpriteFX(TempValue0, FX_FLIP, [Link], [Link])
end if

[Link]++
[Link] %= 40
break

case TAILS_SKIDDING
case TAILS_SPIN_DASH
TempValue0 = [Link]
TempValue0 >>= 2
TempValue0 += 11

if [Link] == true
DrawSpriteFX(TempValue0, FX_FLIP, [Link], [Link])
end if

[Link]++
[Link] %= 12
break

case TAILS_JUMPING
case TAILS_ROLL3D
TempValue0 = [Link]
TempValue0 >>= 2

CheckEqual([Link], 0)
TempValue1 = CheckResult
CheckEqual([Link], 0)
TempValue1 &= CheckResult
if TempValue1 == false
ATan2([Link], [Link], [Link])
[Link] += 16
[Link] &= 255
[Link] >>= 5
// Rotates the tails according to Tails's rotation
switch [Link]
case 0
case 8
TempValue0 += 5
[Link] = 0
break
case 1
TempValue0 += 8
if [Link] == FACING_RIGHT
[Link] = 64
else
[Link] = 0
end if
break

case 2
TempValue0 += 5
[Link] = 64
break

case 3
TempValue0 += 8
if [Link] == FACING_RIGHT
[Link] = 128
else
[Link] = 64
end if
break

case 4
TempValue0 += 5
[Link] = 128
break

case 5
TempValue0 += 8
if [Link] == FACING_RIGHT
[Link] = 192
else
[Link] = 128
end if
break

case 6
TempValue0 += 5
[Link] = 192
break

case 7
TempValue0 += 8
if [Link] == FACING_RIGHT
[Link] = 0
else
[Link] = 192
end if
break
end switch

if [Link] == FACING_LEFT
[Link] += 128
end if
else
TempValue0 += 5
[Link] = 0
end if
[Link] <<= 1

if [Link] == true
DrawSpriteFX(TempValue0, FX_ROTATE, [Link], [Link])
end if

[Link]++
[Link] %= 12
break

case TAILS_PUSHING
TempValue0 = [Link]
TempValue0 /= 10
TempValue0 += 11

if [Link] == true
DrawSpriteFX(TempValue0, FX_FLIP, [Link], [Link])
end if

[Link]++
[Link] %= 30
break
end switch
end sub

sub ObjectStartup
if [Link] == PLAYER_TAILS
LoadSpriteSheet("Players/[Link]")

Object[1].Type = TypeName[Tails Object]


[Link] = 8
[Link] = PRIORITY_ACTIVE

// Idle Frames
SpriteFrame(-22, -8, 16, 24, 82, 199) // #0 - Tail Idle Frame 0
SpriteFrame(-26, -8, 20, 24, 99, 199) // #1 - Tail Idle Frame 1
SpriteFrame(-26, -8, 20, 24, 120, 199) // #2 - Tail Idle Frame 2
SpriteFrame(-26, -8, 20, 24, 141, 199) // #3 - Tail Idle Frame 3
SpriteFrame(-26, -8, 20, 24, 162, 199) // #4 - Tail Idle Frame 4

// Rolling Frames
SpriteFrame(-35, -8, 24, 16, 231, 166) // #5 - Tail Rolling Frame 0
SpriteFrame(-35, -8, 24, 16, 231, 183) // #6 - Tail Rolling Frame 1
SpriteFrame(-35, -8, 24, 16, 231, 200) // #7 - Tail Rolling Frame 2

// Jumping Frames
SpriteFrame(-25, 9, 20, 16, 235, 217) // #8 - Tail Jumping Frame 0
SpriteFrame(-25, 9, 18, 16, 237, 234) // #9 - Tail Jumping Frame 1
SpriteFrame(-25, 9, 20, 16, 216, 234) // #10 - Tail Jumping Frame 2
SpriteFrame(-30, -6, 24, 16, 231, 166) // #11 - Tail Jumping Frame 3
SpriteFrame(-30, -6, 24, 16, 231, 183) // #12 - Tail Jumping Frame 4
SpriteFrame(-30, -6, 24, 16, 231, 200) // #13 - Tail Jumping Frame 5
end if
end sub

// ========================
// Editor Subs
// ========================

sub RSDKDraw
DrawSprite(0)
end sub

sub RSDKLoad
LoadSpriteSheet("Players/[Link]")
SpriteFrame(-22, -8, 16, 24, 82, 199) // Tail Idle Frame 0

SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")
end sub

You might also like