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


event ObjectUpdate
	object.xpos += object.xvel

	// Animate the object
	object.frame = object.animationTimer
	object.frame >>= 2
	object.animationTimer++
	object.animationTimer &= 7

	if object.outOfBounds == true
		object.type = TypeName[Blank Object]
	end if

	// Check interaction with players
	foreach (GROUP_PLAYERS, currentPlayer, ACTIVE_ENTITIES)
		BoxCollisionTest(C_TOUCH, object.entityPos, -4, -4, 4, 4, currentPlayer, C_BOX, C_BOX, C_BOX, C_BOX)
		if checkResult == true
			CallFunction(Player_FireHit)
		end if
	next
end event


event ObjectDraw
	DrawSpriteFX(object.frame, FX_FLIP, object.xpos, object.ypos)
end event


event ObjectStartup
	CheckCurrentStageFolder("Zone05")
	if checkResult == true
		LoadSpriteSheet("HTZ/Objects.gif")
		SpriteFrame(-4, -4, 8, 8, 158, 95)
		SpriteFrame(-4, -4, 8, 8, 166, 95)
	else
		LoadSpriteSheet("MBZ/Objects.gif")
		SpriteFrame(-4, -4, 8, 8, 480, 179)
		SpriteFrame(-4, -4, 8, 8, 488, 179)
	end if
end event


event RSDKDraw
	DrawSprite(0)
end event


event RSDKLoad
	CheckCurrentStageFolder("Zone05")
	if checkResult == true
		LoadSpriteSheet("HTZ/Objects.gif")
		SpriteFrame(-4, -4, 8, 8, 158, 95)
	else
		LoadSpriteSheet("MBZ/Objects.gif")
		SpriteFrame(-4, -4, 8, 8, 480, 179)
	end if

	SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")
end event
