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

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

private alias object.value0 : object.timer


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

event ObjectUpdate
	object.xpos += object.xvel
	object.ypos += object.yvel

	foreach (GROUP_PLAYERS, currentPlayer, ACTIVE_ENTITIES)
		BoxCollisionTest(C_TOUCH, object.entityPos, -7, -7, 7, 7, currentPlayer, C_BOX, C_BOX, C_BOX, C_BOX)
		if checkResult == true
			CallFunction(Player_FireHit)
		end if
	next

	object.frame = object.timer
	object.frame >>= 2
	object.frame &= 1
	if object.timer > 4
		object.frame += 2
	end if

	object.timer++
	if object.timer == 20
		object.type = TypeName[Blank Object]
	end if
end event


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


event ObjectStartup
	LoadSpriteSheet("HPZ/Objects.gif")
	
	SpriteFrame(-4, -4, 7, 8, 176, 131)
	SpriteFrame(-4, -4, 7, 8, 184, 131)
	SpriteFrame(-7, -8, 14, 16, 151, 112)
	SpriteFrame(-7, -8, 14, 16, 166, 112)
end event


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

event RSDKDraw
	DrawSprite(0)
end event


event RSDKLoad
	LoadSpriteSheet("HPZ/Objects.gif")
	SpriteFrame(-4, -4, 7, 8, 176, 131)
	
	SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")
end event
