Yellow Spring
Yellow Spring
//-------Aliases-------//
private alias 16 : TYPE_YELLOWSPRING
private alias object.value3 : object.springCount
private alias object.value4 : object.springStop
private alias object.value5 : object.springTime
// Function declarations
reserve function YellowSpring_DebugDraw
reserve function YellowSpring_DebugSpawn
// Static Values
public value YellowSpring_value27 = 0;
// Tables
function YellowSpring_DebugDraw
temp0 = object[0].value17
temp0 -= YellowSpring_value27
DrawSprite(temp0)
temp0 += 4
DrawSprite(temp0)
end function
function YellowSpring_DebugSpawn
temp0 = object[0].value17
temp0 -= YellowSpring_value27
CreateTempObject(TypeName[Yellow Spring], temp0, object.xpos, object.ypos)
end function
event ObjectMain
if object.springTime > 0
object.springTime--
else
object.springCount = 0
end if
if object.springCount == 5
object.springTime = 30
object.springCount = 0
object.springStop = 1
end if
if object.springStop == 1
if object.springTime == 0
BoxCollisionTest(C_TOUCH, object.entityPos, -14, -10, 14, -6, 0,
HITBOX_AUTO, HITBOX_AUTO, HITBOX_AUTO, HITBOX_AUTO)
if checkResult == 0
object.springStop = 0
end if
end if
else
object[currentPlayer].value10 = ANI_WALKING
if object[currentPlayer].animation == ANI_RUNNING
object[currentPlayer].value10 = ANI_RUNNING
end if
if object[currentPlayer].animation == ANI_PEELOUT
object[currentPlayer].value10 = ANI_PEELOUT
end if
object.value0 = 1
object[currentPlayer].state = PlayerObject_HandleAir
object[currentPlayer].tileCollisions = 1
object[currentPlayer].gravity = GRAVITY_AIR
object[currentPlayer].speed =
object[currentPlayer].xvel
object[currentPlayer].yvel = -0xA0000
object[currentPlayer].yvel += object.value2
object[currentPlayer].animation = ANI_BOUNCING
object[currentPlayer].value35 = 0
object[currentPlayer].value1 = 0
PlaySfx(SfxName[Spring], 0)
object[currentPlayer].value35 = 0
end if
else
if object[currentPlayer].yvel >= 0
BoxCollisionTest(C_PLATFORM, object.entityPos, -14, -
8, 14, 8, currentPlayer, HITBOX_AUTO, HITBOX_AUTO, HITBOX_AUTO, HITBOX_AUTO)
BoxCollisionTest(C_TOUCH, object.entityPos, -14, -10,
14, -6, currentPlayer, HITBOX_AUTO, HITBOX_AUTO, HITBOX_AUTO, HITBOX_AUTO)
if checkResult == 1
object.springCount++
object.springTime = 30
object[currentPlayer].value10 = ANI_WALKING
if object[currentPlayer].animation ==
ANI_RUNNING
object[currentPlayer].value10 =
ANI_RUNNING
end if
if object[currentPlayer].animation ==
ANI_PEELOUT
object[currentPlayer].value10 =
ANI_PEELOUT
end if
object.value0 = 1
object[currentPlayer].state =
PlayerObject_HandleAir
object[currentPlayer].tileCollisions = 1
object[currentPlayer].gravity = GRAVITY_AIR
object[currentPlayer].speed =
object[currentPlayer].xvel
object[currentPlayer].yvel = -0xA0000
object[currentPlayer].yvel += object.value2
object[currentPlayer].animation = ANI_BOUNCING
object[currentPlayer].value35 = 0
object[currentPlayer].value1 = 0
PlaySfx(SfxName[Spring], 0)
end if
end if
end if
break
case 1
BoxCollisionTest(C_BOX, object.entityPos, -8, -14, 8, 14,
currentPlayer, HITBOX_AUTO, HITBOX_AUTO, HITBOX_AUTO, HITBOX_AUTO)
if object[currentPlayer].gravity == GRAVITY_GROUND
BoxCollisionTest(C_TOUCH, object.entityPos, 6, -14, 10, 14,
currentPlayer, HITBOX_AUTO, HITBOX_AUTO, HITBOX_AUTO, HITBOX_AUTO)
if checkResult == 1
object.springCount++
object.springTime = 30
object.value0 = 1
object[currentPlayer].tileCollisions = 1
object[currentPlayer].speed = 0xA0000
object[currentPlayer].collisionMode = CMODE_FLOOR
object[currentPlayer].pushing = 0
object[currentPlayer].direction = FLIP_NONE
object[currentPlayer].controlLock = 15
PlaySfx(SfxName[Spring], 0)
if object[currentPlayer].state !=
PlayerObject_HandleRoll
object[currentPlayer].state =
PlayerObject_HandleGround
object[currentPlayer].animation = ANI_RUNNING
end if
end if
else
if object.value7 == 1
BoxCollisionTest(C_TOUCH, object.entityPos, 6, -4,
11, 4, currentPlayer, HITBOX_AUTO, HITBOX_AUTO, HITBOX_AUTO, HITBOX_AUTO)
if checkResult == 1
object.springCount++
object.springTime = 30
object.value0 = 1
object[currentPlayer].tileCollisions = 1
object[currentPlayer].speed = 0xA0000
object[currentPlayer].yvel = 0
object[currentPlayer].collisionMode =
CMODE_FLOOR
object[currentPlayer].pushing = 0
object[currentPlayer].direction = FLIP_NONE
object[currentPlayer].controlLock = 15
PlaySfx(SfxName[Spring], 0)
if object[currentPlayer].state !=
PlayerObject_RollingJump
object[currentPlayer].animation =
ANI_BOUNCING
object[currentPlayer].value35 = 0
if object[currentPlayer].animation !=
ANI_JUMPING
object[currentPlayer].animation =
ANI_RUNNING
end if
object.animationSpeed = object.speed
object[currentPlayer].animationSpeed *=
80
object[currentPlayer].animationSpeed /=
0x60000
end if
end if
end if
end if
break
case 2
BoxCollisionTest(C_BOX, object.entityPos, -8, -14, 8, 14,
currentPlayer, HITBOX_AUTO, HITBOX_AUTO, HITBOX_AUTO, HITBOX_AUTO)
if object[currentPlayer].gravity == GRAVITY_GROUND
BoxCollisionTest(C_TOUCH, object.entityPos, -10, -14, -6,
14, currentPlayer, HITBOX_AUTO, HITBOX_AUTO, HITBOX_AUTO, HITBOX_AUTO)
if checkResult == 1
object.springCount++
object.springTime = 30
object.value0 = 1
object[currentPlayer].tileCollisions = 1
object[currentPlayer].speed = -0xA0000
object[currentPlayer].collisionMode = CMODE_FLOOR
object[currentPlayer].pushing = 0
object[currentPlayer].direction = FLIP_X
object[currentPlayer].controlLock = 15
PlaySfx(SfxName[Spring], 0)
if object[currentPlayer].state !=
PlayerObject_HandleRoll
object[currentPlayer].state =
PlayerObject_HandleGround
object[currentPlayer].animation = ANI_RUNNING
end if
end if
else
if object.value7 == 1
BoxCollisionTest(C_TOUCH, object.entityPos, -10, -14,
-6, 14, currentPlayer, HITBOX_AUTO, HITBOX_AUTO, HITBOX_AUTO, HITBOX_AUTO)
if checkResult == 1
object.springCount++
object.springTime = 30
object.value0 = 1
object[currentPlayer].tileCollisions = 1
object[currentPlayer].speed = -0xA0000
object[currentPlayer].yvel = 0
object[currentPlayer].collisionMode =
CMODE_FLOOR
object[currentPlayer].pushing = 0
object[currentPlayer].direction = FLIP_X
object[currentPlayer].controlLock = 15
PlaySfx(SfxName[Spring], 0)
if object[currentPlayer].state !=
PlayerObject_RollingJump
object[currentPlayer].animation =
ANI_BOUNCING
object[currentPlayer].value35 = 0
if object[currentPlayer].animation !=
ANI_JUMPING
object[currentPlayer].animation =
ANI_RUNNING
end if
object.animationSpeed = object.speed
FlipSign(object[currentPlayer].animationSpeed)
object[currentPlayer].animationSpeed *=
80
object[currentPlayer].animationSpeed /=
0x60000
end if
end if
end if
end if
break
case 3
BoxCollisionTest(C_BOX, object.entityPos, -14, -8, 14, 8,
currentPlayer, HITBOX_AUTO, HITBOX_AUTO, HITBOX_AUTO, HITBOX_AUTO)
BoxCollisionTest(C_TOUCH, object.entityPos, -14, 6, 14, 10,
currentPlayer, HITBOX_AUTO, HITBOX_AUTO, HITBOX_AUTO, HITBOX_AUTO)
if checkResult == 1
object.springCount++
object.springTime = 30
object.value0 = 1
if object[currentPlayer].collisionMode == CMODE_ROOF
FlipSign(object[currentPlayer].speed)
FlipSign(object[currentPlayer].xvel)
end if
object[currentPlayer].state = 11
object[currentPlayer].tileCollisions = 1
object[currentPlayer].gravity = GRAVITY_AIR
object[currentPlayer].value35 = 0
object[currentPlayer].speed = object[currentPlayer].xvel
object[currentPlayer].yvel = 0xA0000
object[currentPlayer].value1 = 0
PlaySfx(SfxName[Spring], 0)
end if
break
end switch
next
end if
end event
event ObjectDraw
if object.value0 == 0
temp1 = object.propertyValue
DrawSpriteFX(temp1, FX_FLIP, object.xpos, object.ypos)
temp1 += 4
DrawSpriteFX(temp1, FX_FLIP, object.xpos, object.ypos)
else
switch object.value0
case 2
case 3
temp1 = object.propertyValue
DrawSpriteFX(temp1, FX_FLIP, object.xpos, object.ypos)
temp1 += 4
DrawSpriteFX(temp1, FX_FLIP, object.xpos, object.ypos)
break
case 1
temp1 = object.propertyValue
temp1 += 8
DrawSpriteFX(temp1, FX_FLIP, object.xpos, object.ypos)
break
case 4
case 5
case 6
case 7
case 8
case 9
temp1 = object.propertyValue
temp1 += 12
DrawSpriteFX(temp1, FX_FLIP, object.xpos, object.ypos)
temp1 += 4
DrawSpriteFX(temp1, FX_FLIP, object.xpos, object.ypos)
break
end switch
object.value0++
if object.value0 >= 10
object.value0 = 0
end if
end if
end event
event ObjectStartup
LoadSpriteSheet("Global/Items.gif")
SpriteFrame(-16, 0, 32, 8, 84, 9)
SpriteFrame(-8, -16, 8, 32, 141, 26)
SpriteFrame(0, -16, 8, 32, 141, 59)
SpriteFrame(-16, -8, 32, 8, 150, 101)
SpriteFrame(-16, -8, 32, 8, 84, 18)
SpriteFrame(0, -16, 8, 32, 133, 26)
SpriteFrame(-8, -16, 8, 32, 149, 59)
SpriteFrame(-16, 0, 32, 8, 150, 92)
SpriteFrame(-16, 0, 32, 8, 84, 18)
SpriteFrame(-8, -16, 8, 32, 133, 26)
SpriteFrame(0, -16, 8, 32, 149, 59)
SpriteFrame(-16, -8, 32, 8, 150, 92)
SpriteFrame(-16, -16, 32, 24, 117, 1)
SpriteFrame(-8, -16, 24, 32, 158, 26)
SpriteFrame(-16, -16, 24, 32, 158, 59)
SpriteFrame(-16, -8, 32, 24, 150, 1)
SpriteFrame(-16, -24, 32, 8, 84, 18)
SpriteFrame(16, -16, 8, 32, 133, 26)
SpriteFrame(-24, -16, 8, 32, 149, 59)
SpriteFrame(-16, 16, 32, 8, 150, 92)
foreach (TypeName[Yellow Spring], arrayPos0, ALL_ENTITIES)
if object[arrayPos0].propertyValue == 5
object[arrayPos0].propertyValue = 0
object[arrayPos0].value2 = -0x4000
end if
next
temp0 = 0
YellowSpring_value27 = DebugMode_ObjCount
while temp0 < 4
SetTableValue(TypeName[Yellow Spring], DebugMode_ObjCount,
DebugMode_TypesTable)
SetTableValue(YellowSpring_DebugDraw, DebugMode_ObjCount,
DebugMode_DrawTable)
SetTableValue(YellowSpring_DebugSpawn, DebugMode_ObjCount,
DebugMode_SpawnTable)
DebugMode_ObjCount++
temp0++
loop
end event
event RSDKDraw
temp1 = object.propertyValue
if temp1 == 5
temp1 = 0
end if
event RSDKLoad
LoadSpriteSheet("Global/Items.gif")
SpriteFrame(-16, 0, 32, 8, 84, 9)
SpriteFrame(-8, -16, 8, 32, 141, 26)
SpriteFrame(0, -16, 8, 32, 141, 59)
SpriteFrame(-16, -8, 32, 8, 150, 101)
SpriteFrame(-16, -8, 32, 8, 84, 18)
SpriteFrame(0, -16, 8, 32, 133, 26)
SpriteFrame(-8, -16, 8, 32, 149, 59)
SpriteFrame(-16, 0, 32, 8, 150, 92)
SpriteFrame(-16, 0, 32, 8, 84, 18)
SpriteFrame(-8, -16, 8, 32, 133, 26)
SpriteFrame(0, -16, 8, 32, 149, 59)
SpriteFrame(-16, -8, 32, 8, 150, 92)
SpriteFrame(-16, -16, 32, 24, 117, 1)
SpriteFrame(-8, -16, 24, 32, 158, 26)
SpriteFrame(-16, -16, 24, 32, 158, 59)
SpriteFrame(-16, -8, 32, 24, 150, 1)
SpriteFrame(-16, -24, 32, 8, 84, 18)
SpriteFrame(16, -16, 8, 32, 133, 26)
SpriteFrame(-24, -16, 8, 32, 149, 59)
SpriteFrame(-16, 16, 32, 8, 150, 92)
end event