Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
rubberduckycooly
GitHub Repository: rubberduckycooly/Sonic-CD-2011-Script-Decompilation
Path: blob/main/Scripts/Animals/R4_YellowFish.txt
1319 views
1
//---------------Sonic CD Yellow Fish Script------------------//
2
//--------Scripted by Christian Whitehead 'The Taxman'--------//
3
//-------Unpacked By Rubberduckycooly's Script Unpacker-------//
4
5
// Aliases
6
#alias Object.Value0 : Object.Timer
7
#alias Object.Value1 : Object.Angle
8
9
// HUD alias
10
#alias Object[24].PropertyValue : HUD.CurrentTimePeriod
11
12
// States
13
#alias 0 : YELLOWFISH_SWIMRIGHT
14
#alias 1 : YELLOWFISH_SWIMLEFT
15
16
// Time Period Aliases
17
#alias 2 : TIME_GOOD_FUTURE
18
19
20
sub ObjectMain
21
switch Object.State
22
case YELLOWFISH_SWIMRIGHT
23
if Object.Angle < 512
24
Object.Angle += 2
25
26
// Move the fish right a pixel
27
Object.XPos += 0x10000
28
else
29
// Turn around
30
31
Object.State = YELLOWFISH_SWIMLEFT
32
Object.Direction = FACING_LEFT
33
end if
34
break
35
36
case YELLOWFISH_SWIMLEFT
37
if Object.Angle > 0
38
Object.Angle -= 2
39
40
// Move the fish a pixel left
41
Object.XPos -= 0x10000
42
else
43
// Turn once back around
44
45
Object.State = YELLOWFISH_SWIMRIGHT
46
Object.Direction = FACING_RIGHT
47
end if
48
break
49
50
end switch
51
52
// Animate the Fish
53
Object.Timer++
54
if Object.Timer > 19
55
Object.Timer = 0
56
57
Object.Frame++
58
Object.Frame &= 1
59
end if
60
61
end sub
62
63
64
sub ObjectDraw
65
if MetalSonic_Destroyed == true
66
Sin(TempValue1, Object.Angle)
67
TempValue1 <<= 12
68
TempValue1 += Object.YPos
69
70
DrawSpriteFX(Object.Frame, FX_FLIP, Object.XPos, TempValue1)
71
end if
72
73
if HUD.CurrentTimePeriod == TIME_GOOD_FUTURE
74
Sin(TempValue1, Object.Angle)
75
TempValue1 <<= 12
76
TempValue1 += Object.YPos
77
78
DrawSpriteFX(Object.Frame, FX_FLIP, Object.XPos, TempValue1)
79
end if
80
81
end sub
82
83
84
sub ObjectStartup
85
86
LoadSpriteSheet("R4/Objects3.gif")
87
88
// Fish Frames
89
90
SpriteFrame(-8, -12, 16, 24, 1, 92)
91
SpriteFrame(-8, -12, 16, 24, 18, 92)
92
93
end sub
94
95
96
// ========================
97
// Editor Subs
98
// ========================
99
100
sub RSDKDraw
101
DrawSprite(0)
102
end sub
103
104
105
sub RSDKLoad
106
LoadSpriteSheet("R4/Objects3.gif")
107
SpriteFrame(-8, -12, 16, 24, 1, 92)
108
109
SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")
110
end sub
111
112