// ----------------------------------
// RSDK Project: Sonic 1
// Script Description: GHZ Eggman Object
// Script Author: Christian Whitehead/Simon Thomley
// Unpacked by Rubberduckycooly's script unpacker
// ----------------------------------

// Using GHZEggman as a prefix here because there's like 6 "Eggman" objects in the game so its less confusing this way

// ========================
// Aliases
// ========================

private alias object.value0 : object.timer
private alias object.value1 : object.health
private alias object.value2 : object.arenaBorder
private alias object.value3 : object.oscillatePos
private alias object.value4 : object.originY
private alias object.value5 : object.arenaOffset
private alias object.value6 : object.ballPos
private alias object.value7 : object.lightPos

// object[-1] (WreckingBall) Aliases,
// this object is structured like a v3 one so these are all used here instead of in WreckingBall
private alias object.value1 : object.initialMoveVel
private alias object.value2 : object.moveVelocity
private alias object.value3 : object.arenaSize
private alias object.value4 : object.invincibilityTimer
private alias object.value5 : object.gravityStrength
private alias object.value6 : object.flameAnim
private alias object.value7 : object.flameAnimTimer

// Eggman States
private alias 0  : GHZEGGMAN_AWAITPLAYER
private alias 1  : GHZEGGMAN_ENTEREGGMAN
private alias 2  : GHZEGGMAN_MOVEINTOPLACE
private alias 3  : GHZEGGMAN_LOWERBALL
private alias 4  : GHZEGGMAN_INITIALSWING
private alias 5  : GHZEGGMAN_MOVERIGHT
private alias 6  : GHZEGGMAN_MOVELEFT
private alias 7  : GHZEGGMAN_EXPLODE
private alias 8  : GHZEGGMAN_DEFEATFALL
private alias 9  : GHZEGGMAN_DEFEATRISE
private alias 10 : GHZEGGMAN_FLEE
private alias 11 : GHZEGGMAN_ESCAPE

// Wrecking Ball States
private alias 0 : WRECKINGBALL_INACTIVE
private alias 1 : WRECKINGBALL_ACTIVE
private alias 2 : WRECKINGBALL_EXPLODE

// Eggman Animations
private alias 0 : GHZEGGANI_INVISIBLE
private alias 1 : GHZEGGANI_IDLE
private alias 2 : GHZEGGANI_LAUGH
private alias 3 : GHZEGGANI_HIT
private alias 4 : GHZEGGANI_DEFEATED
private alias 5 : GHZEGGANI_TOASTED
private alias 6 : GHZEGGANI_PANIC

// Flame Animations
private alias 0 : FLAME_INACTIVE
private alias 1 : FLAME_ACTIVE
private alias 2 : FLAME_EXPLODE

// Player Aliases
private alias object.xpos : player.xpos
private alias object.xvel : player.xvel
private alias object.speed: player.speed
private alias object.animation : player.animation
private alias object.collisionRight : player.collisionRight

// Music Events
private alias 26 : SLOT_MUSICEVENT_BOSS

private alias 0 : MUSICEVENT_FADETOBOSS
private alias 1 : MUSICEVENT_FADETOSTAGE
private alias 2 : MUSICEVENT_TRANSITION


// ========================
// Function Declarations
// ========================

reserve function GHZEggman_Oscillate
reserve function GHZEggman_FlyAway
reserve function GHZEggman_SwingBall


// ========================
// Function Definitions
// ========================

private function GHZEggman_Oscillate
	object.rotation += 2
	object.rotation &= 511
	temp0 = object.rotation
	temp0 <<= 1
	temp0 += 128
	Sin(object.ypos, temp0)
	object.ypos <<= 9
	object.ypos += object.originY
end function


private function GHZEggman_FlyAway
	object.rotation += 4
	object.rotation &= 511
	Sin(object.ypos, object.rotation)
	object.ypos <<= 9
	object.ypos += object.oscillatePos
end function


private function GHZEggman_SwingBall
	// Lights
	object[-6].xpos = object.xpos
	object[-6].ypos = object.ypos
	object[-6].ypos += object.lightPos
	Sin(temp1, object.rotation)
	temp1 >>= 2
	temp1 += 128
	
	// Chain 1
	temp0 = 16
	Cos(object[-5].xpos, temp1)
	object[-5].xpos *= temp0
	object[-5].xpos <<= 7
	object[-5].xpos += object[-6].xpos
	Sin(object[-5].ypos, temp1)
	object[-5].ypos *= temp0
	object[-5].ypos <<= 7
	object[-5].ypos += object[-6].ypos

	// Chain 2
	temp0 += 16
	Cos(object[-4].xpos, temp1)
	object[-4].xpos *= temp0
	object[-4].xpos <<= 7
	object[-4].xpos += object[-6].xpos
	Sin(object[-4].ypos, temp1)
	object[-4].ypos *= temp0
	object[-4].ypos <<= 7
	object[-4].ypos += object[-6].ypos

	// Chain 3
	temp0 += 16
	Cos(object[-3].xpos, temp1)
	object[-3].xpos *= temp0
	object[-3].xpos <<= 7
	object[-3].xpos += object[-6].xpos
	Sin(object[-3].ypos, temp1)
	object[-3].ypos *= temp0
	object[-3].ypos <<= 7
	object[-3].ypos += object[-6].ypos

	// Chain 4
	temp0 += 16
	Cos(object[-2].xpos, temp1)
	object[-2].xpos *= temp0
	object[-2].xpos <<= 7
	object[-2].xpos += object[-6].xpos
	Sin(object[-2].ypos, temp1)
	object[-2].ypos *= temp0
	object[-2].ypos <<= 7
	object[-2].ypos += object[-6].ypos

	// Ball
	temp0 += 32
	Cos(object[-1].xpos, temp1)
	object[-1].xpos *= temp0
	object[-1].xpos <<= 7
	object[-1].xpos += object[-6].xpos
	Sin(object[-1].ypos, temp1)
	object[-1].ypos *= temp0
	object[-1].ypos <<= 7
	object[-1].ypos += object[-6].ypos
	object[-1].rotation = temp1

	if object.rotation >= 0x100
		object.direction = FLIP_NONE
	else
		object.direction = FLIP_X
	end if
end function


// ========================
// Events
// ========================

event ObjectUpdate
	switch object.state
	case GHZEGGMAN_AWAITPLAYER
		temp0 = object[-1].ixpos
		temp0 -= screen.xcenter
		stage.newXBoundary1 = temp0

		temp0 = object[-1].ixpos
		temp0 += screen.xcenter
		stage.newXBoundary2 = temp0

		temp0 = object.iypos
		temp0 += 64
		if screen.yoffset > temp0
			if player[0].xpos > object[-1].xpos
				object.animation = GHZEGGANI_IDLE
#platform: USE_ORIGINS
				if game.bossOneLife == false
					object.health = 8
				else
					object.health = 1
				end if
#endplatform
#platform: USE_STANDALONE
				object.health = 8
#endplatform
				ResetObjectEntity(SLOT_MUSICEVENT_BOSS, TypeName[Music Event], MUSICEVENT_FADETOBOSS, 0, 0)
				object[SLOT_MUSICEVENT_BOSS].priority = PRIORITY_ACTIVE
				object.state++
			end if
		end if
		break

	case GHZEGGMAN_ENTEREGGMAN
		object.ypos += 0x10000
		if object.ypos >= object.oscillatePos
			object.ypos = object.oscillatePos
			object.timer = 96
			object[-1].flameAnim = FLAME_ACTIVE
			object.state++
		end if
		break

	case GHZEGGMAN_MOVEINTOPLACE
		if object.timer > 0
			object.timer--
			object.xpos = object.timer
			object.xpos <<= 16
			object.xpos += object[-1].xpos
			temp0 = object.timer
			temp0 <<= 7
			temp0 /= 96
			Cos(object.ypos, temp0)
			object.ypos *= -0xB00
			object.ypos += object.oscillatePos
		else
			object.xpos = object[-1].xpos
			object.arenaBorder = object[-1].xpos
			object.ypos = object.originY
			object.originY -= 0x40000
			object.state++
			object[-1].type = TypeName[Wrecking Ball]
			object[-1].ypos = object.ypos
			object[-6].type = TypeName[Boss Lights]
			object[-6].ypos = object.ypos
			object.animation = GHZEGGANI_LAUGH
			object[-1].flameAnim = FLAME_INACTIVE
		end if
		break

	case GHZEGGMAN_LOWERBALL
		if object.ballPos < 0x7C0000
			CallFunction(GHZEggman_Oscillate)
			
			object.ballPos += 0x10000
			if object.lightPos < 0x1C0000
				object.lightPos += 0x8000
			end if

			if object.ballPos > 0x2C0000
				object[-5].type = TypeName[Boss Chain]
			end if

			if object.ballPos > 0x3C0000
				object[-4].type = TypeName[Boss Chain]
			end if
			
			if object.ballPos > 0x4C0000
				object[-3].type = TypeName[Boss Chain]
			end if

			if object.ballPos > 0x5C0000
				object[-2].type = TypeName[Boss Chain]
			end if

			// Ball
			object[-1].ypos = object.ypos
			object[-1].ypos += object.ballPos

			// Lights
			object[-6].ypos = object.ypos
			object[-6].ypos += object.lightPos

			// Chain 1
			object[-5].ypos = object[-6].ypos
			object[-5].ypos += 0x100000

			// Chain 2
			object[-4].ypos = object[-5].ypos
			object[-4].ypos += 0x100000

			// Chain 3
			object[-3].ypos = object[-4].ypos
			object[-3].ypos += 0x100000

			// Chain 4
			object[-2].ypos = object[-3].ypos
			object[-2].ypos += 0x100000

			object.animationTimer %= 10
		else
			object.rotation = 256
			CallFunction(GHZEggman_Oscillate)
			CallFunction(GHZEggman_SwingBall)
			object[-1].initialMoveVel = object.arenaOffset
			object[-1].initialMoveVel >>= 2
			object[-1].moveVelocity = object.arenaOffset
			object[-1].arenaSize = object.arenaOffset
			object[-1].arenaSize *= 64
			temp0 = object[-1].arenaSize
			temp0 >>= 1
			object.arenaBorder -= temp0
			object.state++
			object.animation = GHZEGGANI_IDLE
			object[-1].flameAnim = FLAME_ACTIVE
			object[-1].state = WRECKINGBALL_ACTIVE
		end if
		break

	case GHZEGGMAN_INITIALSWING
		CallFunction(GHZEggman_Oscillate)
		CallFunction(GHZEggman_SwingBall)
		if object.xpos > object.arenaBorder
			object.xpos -= object[-1].initialMoveVel
			if object.xpos < object.arenaBorder
				object.xpos = object.arenaBorder
			end if
		else
			object[-1].flameAnim = FLAME_INACTIVE
			object.arenaBorder += object[-1].arenaSize
			object.state++
		end if
		break

	case GHZEGGMAN_MOVERIGHT
		CallFunction(GHZEggman_Oscillate)
		CallFunction(GHZEggman_SwingBall)
		if object.xpos < object.arenaBorder
			if object.rotation >= 128
				object[-1].flameAnim = FLAME_ACTIVE
				object.xpos += object[-1].moveVelocity
				if object.xpos > object.arenaBorder
					object.xpos = object.arenaBorder
				end if
			end if
		else
			object[-1].flameAnim = FLAME_INACTIVE
			object.arenaBorder -= object[-1].arenaSize
			object.state++
		end if
		break

	case GHZEGGMAN_MOVELEFT
		CallFunction(GHZEggman_Oscillate)
		CallFunction(GHZEggman_SwingBall)
		if object.xpos > object.arenaBorder
			if object.rotation >= 384
				object[-1].flameAnim = FLAME_ACTIVE
				object.xpos -= object[-1].moveVelocity
				if object.xpos < object.arenaBorder
					object.xpos = object.arenaBorder
				end if
			end if
		else
			object[-1].flameAnim = FLAME_INACTIVE
			object.arenaBorder += object[-1].arenaSize
			object.state--
		end if
		break

	case GHZEGGMAN_EXPLODE
		object.timer++
		temp0 = object.timer
		temp0 &= 7
		if temp0 == 4
			Rand(temp0, 96)
			temp0 -= 48
			temp0 <<= 16
			temp0 += object.xpos
			Rand(temp1, 48)
			temp1 -= 24
			temp1 <<= 16
			temp1 += object.ypos
			CreateTempObject(TypeName[Explosion], 0, temp0, temp1)
			PlaySfx(SfxName[Explosion], false)
		end if

		if object.timer == 180
			object.animation = GHZEGGANI_TOASTED
			object.animationTimer = 0
			object.timer = 0
			object.direction = FLIP_X
			ResetObjectEntity(SLOT_MUSICEVENT_BOSS, TypeName[Music Event], MUSICEVENT_FADETOSTAGE, 0, 0)
			object[SLOT_MUSICEVENT_BOSS].priority = PRIORITY_ACTIVE
			object.state++
		end if
		break

	case GHZEGGMAN_DEFEATFALL
		object.ypos += object[-1].gravityStrength
		object[-1].gravityStrength += 0x1800
		
		object.timer++
		if object.timer == 38
			object[-1].gravityStrength = 0
			object.timer = 0
			object.animationTimer = 0
			object.state++
		end if
		break

	case GHZEGGMAN_DEFEATRISE
		if object.timer < 48
			object.ypos += object[-1].gravityStrength
			object[-1].gravityStrength -= 0x800
			object.timer++
		else
			object.timer = 0
			object[-1].gravityStrength = 0
			object.rotation = 0
			object.oscillatePos = object.ypos
			object.state++
		end if
		break

	case GHZEGGMAN_FLEE
		CallFunction(GHZEggman_FlyAway)

		if object.timer < 8
			object.timer++
		else
			object.timer = 0
			object.animation = GHZEGGANI_PANIC
			object.animationTimer = 0
			object[-1].flameAnim = FLAME_EXPLODE
			object[-1].flameAnimTimer = 0
			object.priority = PRIORITY_ACTIVE
			temp0 = tileLayer[0].xsize
			temp0 <<= 7
			stage.newXBoundary2 = temp0
			object.state++
		end if
		break

	case GHZEGGMAN_ESCAPE
		CallFunction(GHZEggman_FlyAway)
		object.xpos += 0x40000
		object.oscillatePos -= 0x4000
		if object.outOfBounds == true
			object.type = TypeName[Blank Object]
			object.priority = PRIORITY_BOUNDS
		end if
		break

	end switch

	if object[-1].invincibilityTimer > 0
		object[-1].invincibilityTimer--
	end if

	foreach (GROUP_PLAYERS, currentPlayer, ACTIVE_ENTITIES)
		if object[-1].invincibilityTimer == 0

			CheckEqual(player[currentPlayer].animation, ANI_HURT)
			temp0 = checkResult
			CheckEqual(player[currentPlayer].animation, ANI_DYING)
			temp0 |= checkResult
			CheckEqual(player[currentPlayer].animation, ANI_DROWNING)
			temp0 |= checkResult
			if temp0 != 0
				if object.animation != GHZEGGANI_LAUGH
					object.animation = GHZEGGANI_LAUGH
					object.animationTimer = 0
				end if
			end if

			switch object.state
			default
				break
				
			case GHZEGGMAN_INITIALSWING
			case GHZEGGMAN_MOVERIGHT
			case GHZEGGMAN_MOVELEFT
				BoxCollisionTest(C_TOUCH, object.entityPos, -20, -16, 20, 16, currentPlayer, C_BOX, C_BOX, C_BOX, C_BOX)
				if checkResult == true
					CallFunction(Player_CheckHit)
					if checkResult == true
						object.health--
						if object.health == 0
#platform: USE_ORIGINS
							CallNativeFunction2(NotifyCallback, NOTIFY_KILL_BOSS, 0)
							CallNativeFunction2(NotifyCallback, NOTIFY_BOSS_END, true)
#endplatform
							player.score += 1000
							object.animationTimer = 0
							object.animation = GHZEGGANI_DEFEATED
							temp0 = object.entityPos
							temp0 -= 2
							ResetObjectEntity(temp0, TypeName[Explosion], 0, object[-2].xpos, object[-2].ypos)
							temp0--
							ResetObjectEntity(temp0, TypeName[Explosion], 0, object[-3].xpos, object[-3].ypos)
							temp0--
							ResetObjectEntity(temp0, TypeName[Explosion], 0, object[-4].xpos, object[-4].ypos)
							temp0--
							ResetObjectEntity(temp0, TypeName[Explosion], 0, object[-5].xpos, object[-5].ypos)
							temp0--
							ResetObjectEntity(temp0, TypeName[Explosion], 0, object[-6].xpos, object[-6].ypos)
							object[-1].state = WRECKINGBALL_EXPLODE
							object[-1].flameAnim = FLAME_INACTIVE
							object.timer = 0
							object.state = GHZEGGMAN_EXPLODE
						else
							object.animationTimer = 0
							object.animation = GHZEGGANI_HIT
							object[-1].invincibilityTimer = 32
							PlaySfx(SfxName[Boss Hit], false)
						end if
					end if
				end if
			end switch

			// Arena Boundaries
			// They're only enforced when Eggman is vulnerable for some reason??
			// (With how the rest of this script is like, maybe this was originally just part of sub ObjectPlayerInteraction,
			//   and only during the updating process these bounds were accidentally moved to only be enforced while vulnerable?
			//   Don't know if what I'm saying even makes any sense, hopefully it does...)
			if object.state < GHZEGGMAN_ESCAPE
				temp0 = player[currentPlayer].collisionRight
				temp0 <<= 16
				temp0 += player[currentPlayer].xpos
				temp1 = stage.curXBoundary2
				temp1 <<= 16
				if temp0 > temp1
					player[currentPlayer].xvel = 0
					player[currentPlayer].speed = 0
					player[currentPlayer].xpos = temp1
					temp0 = player[currentPlayer].collisionRight
					temp0 <<= 16
					player[currentPlayer].xpos -= temp0
				end if
			end if
		end if
	next
end event


event ObjectDraw
	switch object.animation
	default
	case GHZEGGANI_INVISIBLE
		break

	case GHZEGGANI_IDLE
		temp0 = object.animationTimer
		temp0 /= 6
		object.animationTimer++
		object.animationTimer %= 12
		DrawSpriteFX(temp0, FX_FLIP, object.xpos, object.ypos)
		break

	case GHZEGGANI_LAUGH
		temp0 = object.animationTimer
		temp0 %= 10
		temp0 /= 5
		temp0 += 9
		object.animationTimer++
		if object.animationTimer == 50
			object.animationTimer = 0
			if player[0].animation != ANI_DYING
				object.animation = GHZEGGANI_IDLE
			end if
		end if
		DrawSpriteFX(temp0, FX_FLIP, object.xpos, object.ypos)
		break

	case GHZEGGANI_HIT
		temp0 = object.animationTimer
		temp0 &= 1
		temp0 += 2
		object.animationTimer++
		if object.animationTimer == 30
			object.animationTimer = 0
			object.animation = GHZEGGANI_IDLE
		end if
		DrawSpriteFX(temp0, FX_FLIP, object.xpos, object.ypos)
		break

	case GHZEGGANI_DEFEATED
		temp0 = object.animationTimer
		temp0 >>= 5
		temp0 += 4
		object.animationTimer++
		object.animationTimer &= 63
		DrawSpriteFX(temp0, FX_FLIP, object.xpos, object.ypos)
		break

	case GHZEGGANI_TOASTED
		DrawSpriteFX(6, FX_FLIP, object.xpos, object.ypos)
		break

	case GHZEGGANI_PANIC
		temp0 = object.animationTimer
		temp0 >>= 2
		temp0 += 7
		object.animationTimer++
		object.animationTimer %= 7
		DrawSpriteFX(temp0, FX_FLIP, object.xpos, object.ypos)
		break

	end switch

	switch object[-1].flameAnim
	case FLAME_INACTIVE
	default
		break
		
	case FLAME_ACTIVE
		temp0 = object[-1].flameAnimTimer
		temp0 >>= 2
		temp0 += 11
		object[-1].flameAnimTimer++
		object[-1].flameAnimTimer &= 7
		DrawSpriteFX(temp0, FX_FLIP, object.xpos, object.ypos)
		break

	case FLAME_EXPLODE
		temp0 = object[-1].flameAnimTimer
		temp0 /= 3
		temp0 += 11
		object[-1].flameAnimTimer++
		if object[-1].flameAnimTimer > 21
			object[-1].flameAnimTimer = 18
		end if
		DrawSpriteFX(temp0, FX_FLIP, object.xpos, object.ypos)
		break

	end switch
end event


event ObjectStartup
	LoadSpriteSheet("Global/Eggman.gif")
	SpriteFrame(-28, -32, 64, 56, 1, 1)		// ? - #0
	SpriteFrame(-28, -32, 64, 56, 66, 1)	// ? - #1
	SpriteFrame(-28, -32, 64, 56, 131, 1)	// ? - #2
	SpriteFrame(-28, -32, 64, 56, 1, 58)	// ? - #3
	SpriteFrame(-28, -32, 64, 56, 1, 1)		// ? - #4
	SpriteFrame(-28, -32, 64, 56, 1, 58)	// ? - #5
	SpriteFrame(-28, -32, 64, 56, 66, 58)	// ? - #6
	SpriteFrame(-28, -32, 64, 56, 131, 58)	// ? - #7
	SpriteFrame(-28, -32, 64, 56, 66, 1)	// ? - #8
	SpriteFrame(-28, -32, 64, 56, 1, 115)	// ? - #9
	SpriteFrame(-28, -32, 64, 56, 66, 115)	// ? - #10
	SpriteFrame(34, 1, 10, 9, 196, 2) 		// ? - #11
	SpriteFrame(33, 0, 15, 11, 196, 12) 	// ? - #12
	SpriteFrame(34, -1, 22, 14, 213, 1) 	// ? - #13
	SpriteFrame(34, -8, 32, 26, 213, 16) 	// ? - #14
	SpriteFrame(34, -1, 22, 14, 213, 1) 	// ? - #15
	SpriteFrame(34, -8, 32, 26, 213, 16) 	// ? - #16
	SpriteFrame(34, 1, 10, 9, 196, 2) 		// ? - #17
	SpriteFrame(33, 0, 15, 11, 196, 12) 	// ? - #18
	
	foreach (TypeName[Eggman], arrayPos0, ALL_ENTITIES)
		// Prolly a leftover from this script being much more v3-like, this foreach may have originally been a while loop of all objects
		if object[arrayPos0].type == TypeName[Eggman]
			object[arrayPos0].priority = PRIORITY_XBOUNDS
			
			// Screen Offset
			temp0 = screen.xcenter
			temp0 -= 160 //xcenter if screen width was 320 like OG games
			temp0 -= 8
			
			if temp0 < 0
				temp0 = 0
			end if
			
			if temp0 > 24
				temp0 = 24
			end if
			
			object[arrayPos0].arenaOffset = temp0
			object[arrayPos0].arenaOffset += 32
			object[arrayPos0].arenaOffset *= 0x800
			temp0 <<= 16
			
			// Align the left Boss platform
			arrayPos1 = arrayPos0
			arrayPos1++
			object[arrayPos1].xpos -= temp0
			
			// And then align the right Boss platform
			arrayPos1++
			object[arrayPos1].xpos += temp0
			
			// Still looking at the right Boss platform, make the Boss's base oscillation position be 68 pixels above that
			object[arrayPos0].oscillatePos = object[arrayPos1].ypos
			object[arrayPos0].oscillatePos -= 0x440000
			
			// And then, make the base normal position be 90 pixels above the platform
			object[arrayPos0].originY = object[arrayPos1].ypos
			object[arrayPos0].originY -= 0x5A0000
			
			arrayPos1 = arrayPos0
			arrayPos1--
			object[arrayPos0].arenaBorder = object[arrayPos1].xpos
			object[arrayPos0].arenaBorder += 0x600000
			
			object[arrayPos0].xpos = object[arrayPos0].arenaBorder
			object[arrayPos0].ypos = object[arrayPos0].originY
			object[arrayPos0].ypos -= 0xC00000
		end if
	next
end event


// ========================
// Editor Events
// ========================

event RSDKDraw
	DrawSprite(0)
	
	if editor.showGizmos == true
		editor.drawingOverlay = true

		DrawArrow(object.xpos, object.ypos, object[-6].xpos, object[-6].ypos, 255, 255, 0) // Lights
		DrawArrow(object.xpos, object.ypos, object[-5].xpos, object[-5].ypos, 255, 255, 0) // Chain 1
		DrawArrow(object.xpos, object.ypos, object[-4].xpos, object[-4].ypos, 255, 255, 0) // Chain 2
		DrawArrow(object.xpos, object.ypos, object[-3].xpos, object[-3].ypos, 255, 255, 0) // Chain 3
		DrawArrow(object.xpos, object.ypos, object[-2].xpos, object[-2].ypos, 255, 255, 0) // Chain 4
		DrawArrow(object.xpos, object.ypos, object[-1].xpos, object[-1].ypos, 255, 255, 0) // Ball

		DrawArrow(object.xpos, object.ypos, object[+1].xpos, object[+1].ypos, 255, 255, 0) // Platform L
		DrawArrow(object.xpos, object.ypos, object[+2].xpos, object[+2].ypos, 255, 255, 0) // Platform R

		editor.drawingOverlay = false
	end if
end event


event RSDKLoad
	LoadSpriteSheet("Global/Eggman.gif")
	SpriteFrame(-28, -32, 64, 56, 1, 1)
	
	SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")
end event
