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

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

private alias object.value0 : object.timer

// Path ID Aliases
private alias 0 : PATH_A


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

event ObjectUpdate
	object.xpos += object.xvel

	if object.xvel < 0
		ObjectTileCollision(CSIDE_RWALL, -8, 4, PATH_A)
	else
		ObjectTileCollision(CSIDE_LWALL, 8, 4, PATH_A)
	end if

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

	if object.timer < 16
		object.timer++
	else
		object.drawOrder = 3
	end if

	object.frame = oscillation
	object.frame >>= 3
	object.frame &= 1

	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
	LoadSpriteSheet("LZ/Objects.gif")
	
	SpriteFrame(-8, -3, 15, 6, 127, 124)
	SpriteFrame(-8, -3, 15, 6, 127, 131)
end event


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

event RSDKDraw
	DrawSprite(0)
end event


event RSDKLoad
	LoadSpriteSheet("LZ/Objects.gif")
	SpriteFrame(-8, -3, 15, 6, 127, 124)
end event
