Professional Documents
Culture Documents
R7 FlowerPod
R7 FlowerPod
// Aliases
#alias Object.Value0 : Object.Timer
// PodSeed Aliases
#alias Object.Value1 : Object.ParentPod
#alias Object.Value2 : Object.XVelocity
#alias Object.Value3 : Object.YVelocity
// States
#alias 0 : FLOWERPOD_IDLE
#alias 1 : FLOWERPOD_EXPLOSION
#alias 2 : FLOWERPOD_VANISH
#alias 3 : FLOWERPOD_TRIGGER_ACTFINISH
#alias 4 : FLOWERPOD_CONTROL_PLAYER
// Control Modes
#alias -1 : CONTROLMODE_NONE
// Ink Effects
#alias 2 : INK_ALPHA
// Player
#alias 0 : PLAYER_SONIC
// Gravity
#alias 0 : GRAVITY_GROUND
// Global SFX
#alias 22 : SFX_G_EXPLOSION
// Priority
#alias 1 : PRIORITY_ACTIVE
sub ObjectMain
switch Object.State
case FLOWERPOD_IDLE
if Object.Timer < 60
Object.Frame = 1
else
TempValue0 = Object.Timer
TempValue0 -= 60
TempValue0 >>= 1
switch TempValue0
case 0
Object.Frame = 2
break
case 1
case 2
Object.Frame = 1
break
case 3
Object.Frame = 2
break
case 4
case 5
Object.Frame = 1
break
case 6
Object.Frame = 2
break
end switch
end if
Object.Timer++
if Object.Timer == 74
Object.Timer = 0
end if
break
case FLOWERPOD_EXPLOSION
if Object.Timer < 120
Object.Timer++
TempValue0 = Object.Timer
TempValue0 &= 3
if TempValue0 == 3
Rand(TempValue0, 64)
TempValue0 -= 32
TempValue0 <<= 16
TempValue0 += Object.XPos
Rand(TempValue1, 40)
TempValue1 -= 40
TempValue1 <<= 16
TempValue1 += Object.YPos
CreateTempObject(TypeName[Explosion], 0, TempValue0,
TempValue1)
PlaySfx(SFX_G_EXPLOSION, false)
end if
else
Object.State = FLOWERPOD_VANISH
Object.Timer = 256
Object.InkEffect = INK_ALPHA
Object.Alpha = 255
TempValue0 += 0x10000
CreateTempObject(TypeName[Pod Seed], 0, TempValue0, TempValue1)
Object[TempObjectPos].XVelocity = -0x15554
Object[TempObjectPos].YVelocity = -0x60000
TempValue0 += 0x10000
CreateTempObject(TypeName[Pod Seed], 0, TempValue0, TempValue1)
Object[TempObjectPos].XVelocity = -0xAAAA
Object[TempObjectPos].YVelocity = -0x60000
TempValue0 += 0x10000
CreateTempObject(TypeName[Pod Seed], 0, TempValue0, TempValue1)
Object[TempObjectPos].XVelocity = 0
Object[TempObjectPos].YVelocity = -0x60000
TempValue0 += 0x10000
CreateTempObject(TypeName[Pod Seed], 0, TempValue0, TempValue1)
Object[TempObjectPos].XVelocity = 0xAAAA
Object[TempObjectPos].YVelocity = -0x60000
TempValue0 += 0x10000
CreateTempObject(TypeName[Pod Seed], 0, TempValue0, TempValue1)
Object[TempObjectPos].XVelocity = 0x15554
Object[TempObjectPos].YVelocity = -0x60000
TempValue0 += 0x10000
CreateTempObject(TypeName[Pod Seed], 0, TempValue0, TempValue1)
Object[TempObjectPos].XVelocity = 0x20000
Object[TempObjectPos].YVelocity = -0x60000
end if
break
case FLOWERPOD_VANISH
if Object.Timer > 0
Object.Timer -= 16
Object.Alpha = Object.Timer
end if
break
case FLOWERPOD_TRIGGER_ACTFINISH
if Player.ControlMode == CONTROLMODE_NONE
Player.Left = false
Player.Right = false
Player.Up = false
Player.Down = false
Player.JumpHold = false
PlayMusic(1)
Object.State = FLOWERPOD_CONTROL_PLAYER
Object[30].Type = TypeName[ActFinish]
Object[30].DrawOrder = 6
Object[30].Priority = PRIORITY_ACTIVE
end if
break
case FLOWERPOD_CONTROL_PLAYER
if Player.ControlMode == CONTROLMODE_NONE
Player.Right = false
end if
break
end switch
end sub
sub ObjectPlayerInteraction
if Object.State == FLOWERPOD_IDLE
if Player.Animation == ANI_JUMPING
PlayerObjectCollision(C_TOUCH, -28, -46, 28, 6)
if CheckResult == true
Stage.TimeEnabled = false
Object.State = FLOWERPOD_EXPLOSION
Object.Frame = 3
Object.Timer = 0
Player.YVelocity >>= 1
FlipSign(Player.YVelocity)
#platform: Use_Haptics
HapticEffect(55, 0, 0, 0)
#endplatform
#platform: Use_Origins
// Tell the engine that the boss fight has ended
game.callbackParam0 = true
EngineCallback(NOTIFY_BOSS_END)
#endplatform
end if
end if
end if
end sub
sub ObjectDraw
if Object.State < FLOWERPOD_VANISH
DrawSprite(0)
DrawSprite(Object.Frame)
else
DrawSpriteFX(0, FX_INK, Object.XPos, Object.YPos)
DrawSpriteFX(Object.Frame, FX_INK, Object.XPos, Object.YPos)
end if
end sub
sub ObjectStartup
LoadSpriteSheet("R7/Objects2.gif")
// ========================
// Editor Subs
// ========================
sub RSDKDraw
DrawSprite(0)
DrawSprite(1)
end sub
sub RSDKLoad
LoadSpriteSheet("R7/Objects2.gif")
SpriteFrame(-32, 6, 64, 42, 1, 55)
SpriteFrame(-32, -48, 64, 54, 1, 1)
SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")
end sub