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

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

event ObjectUpdate
	temp0 = object.xpos
	temp0 >>= 16
	temp0 -= camera[0].xpos
	Abs(temp0)
	temp0 -= 96
	if temp0 < screen.xcenter
		temp0 = object.ypos
		temp0 >>= 16
		temp0 -= camera[0].ypos
		Abs(temp0)
		if temp0 < 160
			temp0 = oscillation
			temp0 &= 0x1F
			if temp0 == 0
				PlaySfx(SfxName[Helicopter], false)
			end if
		end if
	end if
end event


event ObjectDraw
	DrawSprite(SCZSetup_vPropellerFrame)
end event


event ObjectStartup
	LoadSpriteSheet("SCZ/Objects.gif")
	SpriteFrame(-4, -64, 8, 64, 121, 106)
	SpriteFrame(-4, -32, 8, 64, 121, 106)
	SpriteFrame(-4, 0, 8, 64, 121, 106)
end event


event RSDKDraw
	DrawSprite(0)
end event


event RSDKLoad
	LoadSpriteSheet("SCZ/Objects.gif")
	SpriteFrame(-4, -64, 8, 64, 121, 106)
	
	SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")
end event
