Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
rubberduckycooly
GitHub Repository: rubberduckycooly/Sonic-CD-2011-Script-Decompilation
Path: blob/main/Scripts/FlowerPod/PodSeed.txt
1319 views
1
//------------------Sonic CD Pod Seed 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.ParentPod
8
#alias Object.Value2 : Object.XVelocity
9
#alias Object.Value3 : Object.YVelocity
10
11
// Flower States
12
#alias 2 : FLOWER_SEED_PLANTED_1
13
14
// Collision Sides
15
#alias 0 : CSIDE_FLOOR
16
17
// Player
18
#alias 0 : PLAYER_SONIC_A
19
#alias 1 : PLAYER_TAILS_A
20
21
// Control Mode
22
#alias -1 : CONTROLMODE_NONE
23
24
// Property Values
25
#alias 1 : TRIGGER_RESULTS
26
27
28
sub ObjectMain
29
30
// Animate the seed
31
Object.Frame = Object.Timer
32
Object.Frame /= 3
33
Object.Timer++
34
Object.Timer %= 18
35
36
// Update movements
37
Object.XPos += Object.XVelocity
38
Object.YPos += Object.YVelocity
39
Object.YVelocity += 0x4000
40
41
// Before landing, the object has to be going at a rate of at least 6px per frame
42
if Object.YVelocity > 0x60000
43
ObjectTileCollision(CSIDE_FLOOR, 0, 8, 0)
44
if CheckResult == true
45
if Object.PropertyValue == TRIGGER_RESULTS
46
ArrayPos0 = Object.ParentPod
47
Object[ArrayPos0].State++
48
Player.ControlMode = CONTROLMODE_NONE
49
end if
50
51
// Grow into a Flower
52
ResetObjectEntity(Object.EntityNo, Flower_TypeNo, 0, Object.XPos, Object.YPos)
53
Object.YPos += 0x80000
54
Object.State = FLOWER_SEED_PLANTED_1
55
Object.Frame = 2
56
Object.DrawOrder = 4
57
end if
58
end if
59
60
end sub
61
62
63
sub ObjectDraw
64
DrawSprite(Object.Frame)
65
end sub
66
67
68
sub ObjectStartup
69
if Stage.PlayerListPos == PLAYER_SONIC_A
70
LoadSpriteSheet("Global/Items2.gif")
71
end if
72
if Stage.PlayerListPos == PLAYER_TAILS_A
73
LoadSpriteSheet("Global/Items2_t.gif")
74
end if
75
#platform: Use_Origins
76
if Stage.PlayerListPos == PLAYER_KNUCKLES
77
LoadSpriteSheet("Global/Items2_k.gif")
78
end if
79
if Stage.PlayerListPos == PLAYER_AMY
80
LoadSpriteSheet("Global/Items2_a.gif")
81
end if
82
#endplatform
83
84
// Seed Frames
85
SpriteFrame(-8, -8, 16, 16, 83, 66)
86
SpriteFrame(-8, -8, 16, 16, 83, 83)
87
SpriteFrame(-8, -8, 16, 16, 83, 100)
88
SpriteFrame(-8, -8, 16, 16, 83, 117)
89
SpriteFrame(-8, -8, 16, 16, 83, 83)
90
SpriteFrame(-8, -8, 16, 16, 83, 134)
91
end sub
92
93
94
// ========================
95
// Editor Subs
96
// ========================
97
98
sub RSDKDraw
99
DrawSprite(0)
100
end sub
101
102
103
sub RSDKLoad
104
LoadSpriteSheet("Global/Items2.gif")
105
SpriteFrame(-8, -8, 16, 16, 83, 66)
106
107
// Although used by the object, it's not to be set from the editor
108
SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")
109
end sub
110
111