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


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

event ObjectUpdate
	object.yvel += 0x3800
	object.xpos += object.xvel
	object.ypos += object.yvel
	object.ypos += SCZSetup_scrollVelocity.y

	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

	object.frame++
	object.frame &= 1

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


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


event ObjectStartup
	CheckCurrentStageFolder("Zone10")
	if checkResult == true
		LoadSpriteSheet("SCZ/Objects.gif")
		SpriteFrame(-7, -7, 14, 13, 220, 1)
		SpriteFrame(-7, -7, 14, 13, 220, 15)
	else
		LoadSpriteSheet("MBZ/Objects.gif")
		// Duplicate Sprite Frames as SCZ, these don't actually look too good in MBZ
		SpriteFrame(-7, -7, 14, 13, 220, 1)
		SpriteFrame(-7, -7, 14, 13, 220, 15)
	end if
end event


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

event RSDKDraw
	DrawSprite(0)
end event


event RSDKLoad
	CheckCurrentStageFolder("Zone10")
	if checkResult == true
		LoadSpriteSheet("SCZ/Objects.gif")
		SpriteFrame(-7, -7, 14, 13, 220, 1)
		SpriteFrame(-7, -7, 14, 13, 220, 15)
	else
		LoadSpriteSheet("MBZ/Objects.gif")
		SpriteFrame(-7, -7, 14, 13, 220, 1)
		SpriteFrame(-7, -7, 14, 13, 220, 15)
	end if
	
	SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")
end event
