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


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

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

	temp0 = screen.xcenter
	temp0 += 32
	temp1 = screen.ycenter
	temp1 += 32
	CheckCameraProximity(object.ixpos, object.iypos, temp0, temp1)
	if checkResult == false
		object.type = TypeName[Blank Object]
	end if

	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_ProjectileHit)
		end if
	next
end event


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


event ObjectStartup
	
		LoadSpriteSheet("MPZ/Objects.gif")
		SpriteFrame(-4, -8, 7, 14, 182, 1)
		SpriteFrame(-8, -4, 15, 7, 173, 18)
		SpriteFrame(-4, -3, 8, 11, 173, 6)
	
end event


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

event RSDKDraw
	DrawSprite(0)
end event


event RSDKLoad

		LoadSpriteSheet("MPZ/Objects.gif")
		SpriteFrame(-4, -8, 7, 14, 182, 1)
		SpriteFrame(-8, -4, 15, 7, 173, 18)
		SpriteFrame(-4, -3, 8, 11, 173, 6)
	
	
	// Normally spriteID, this object should never be placed in a scene at all though
	SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")
end event
