Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
rubberduckycooly
GitHub Repository: rubberduckycooly/Sonic-1-Sonic-2-2013-Script-Decompilation
Path: blob/master/Sonic 1/Scripts/SYZ/EdgeStabilizer.txt
1483 views
1
// ----------------------------------
2
// RSDK Project: Sonic 1
3
// Script Description: Edge Stabilizer Object
4
// Script Author: Christian Whitehead/Simon Thomley
5
// Unpacked by Rubberduckycooly's script unpacker
6
// ----------------------------------
7
8
// The object name is a bit odd so I'll just clarify here -
9
// This object's purpose is to make the player not sink at the edge of a triangle chunk
10
// Well I suppose that's an equally as odd description, but since images are worth a thousand words, it's meant to prevent things like this
11
// https://randomsonicnet.org/taxman_sage2007/collisionbug.png
12
13
// ========================
14
// Aliases
15
// ========================
16
17
// Player Aliases
18
private alias object.ypos : player.ypos
19
private alias object.gravity : player.gravity
20
private alias object.collisionBottom : player.collisionBottom
21
22
23
// ========================
24
// Events
25
// ========================
26
27
event ObjectUpdate
28
foreach (GROUP_PLAYERS, currentPlayer, ACTIVE_ENTITIES)
29
if player[currentPlayer].gravity == GRAVITY_GROUND
30
BoxCollisionTest(C_TOUCH, object.entityPos, -8, -8, 8, 8, currentPlayer, C_BOX, C_BOX, C_BOX, C_BOX)
31
if checkResult == true
32
temp0 = player[currentPlayer].collisionBottom
33
temp0 *= -0x10000
34
temp0 -= 0x80000
35
temp0 += object.ypos
36
if player[currentPlayer].ypos > temp0
37
player[currentPlayer].ypos = temp0
38
end if
39
end if
40
end if
41
next
42
end event
43
44
45
// ========================
46
// Editor Events
47
// ========================
48
49
event RSDKDraw
50
DrawSprite(0)
51
52
if editor.showGizmos == true
53
editor.drawingOverlay = true
54
55
// Draw the sensor hitbox
56
temp0 = 8; temp1 = 8; temp2 = 8; temp3 = 8;
57
CallFunction(EditorHelpers_DrawHitbox)
58
59
editor.drawingOverlay = false
60
end if
61
end event
62
63
64
event RSDKLoad
65
LoadSpriteSheet("Global/Display.gif")
66
SpriteFrame(-8, -8, 16, 16, 239, 239) // "Trigger" - #0
67
68
SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")
69
end event
70
71