// ----------------------------------
// RSDK Project: Sonic 1/Sonic 2
// Script Description: Dust Puff Object
// Script Author: Christan Whitehead/Simon Thomley
// Unpacked by Rubberduckycooly's script unpacker
// ----------------------------------

//-------Aliases-------//
private alias 20 : TYPE_DUSTPUFF


// Static Values

// Tables

event ObjectMain
	object.xpos += object.xvel
	object.ypos += object.yvel
	switch object.frame
	case 0
	case 1
	case 2
		object.animationTimer++
		if object.animationTimer > 3
			object.frame++
			object.animationTimer = 0
		end if
		break
	case 3
		object.animationTimer++
		if object.animationTimer > 3
			object.type = TypeName[Blank Object]
		end if
		break
	case 4
	case 5
	case 6
	case 7
	case 8
	case 9
		object.animationTimer++
		if object.animationTimer > 1
			object.frame++
			object.animationTimer = 0
		end if
		break
	case 10
		object.animationTimer++
		if object.animationTimer > 1
			object.frame = 4
			object.animationTimer = 0
		end if
		break
	case 11
	case 12
	case 13
	case 14
	case 15
		object.animationTimer++
		if object.animationTimer > 4
			object.frame++
			object.animationTimer = 0
		end if
		break
	case 16
		object.animationTimer++
		if object.animationTimer > 4
			object.type = TypeName[Blank Object]
		end if
	end switch
end event


event ObjectDraw
	switch object.frame
	case 4
	case 5
	case 6
	case 7
	case 8
	case 9
	case 10
		currentPlayer = object.propertyValue
		object.direction = object[currentPlayer].direction
		object.xpos = object[currentPlayer].xpos
		object.iypos = object[currentPlayer].collisionBottom
		object.ypos += object[currentPlayer].ypos
			if object[currentPlayer].animation != ANI_SPINDASH
				object.type = TypeName[Blank Object]
			else
				DrawSpriteFX(object.frame, FX_FLIP, object.xpos, object.ypos)
			end if
		break
	default
		DrawSpriteFX(object.frame, FX_FLIP, object.xpos, object.ypos)
		break
	end switch
end event


event ObjectStartup
	LoadSpriteSheet("Global/Items.gif")
	SpriteFrame(-7, -11, 13, 14, 85, 143)
	SpriteFrame(-7, -11, 13, 14, 99, 143)
	SpriteFrame(-6, -11, 13, 14, 113, 143)
	SpriteFrame(-7, -11, 13, 14, 127, 143)

	SpriteFrame(-32, -10, 32, 10, 58, 245)
	SpriteFrame(-32, -12, 32, 12, 91, 243)
	SpriteFrame(-32, -16, 32, 16, 124, 239)
	SpriteFrame(-32, -18, 32, 18, 157, 237)
	SpriteFrame(-32, -20, 32, 20, 190, 235)
	SpriteFrame(-32, -21, 32, 21, 223, 210)
	SpriteFrame(-32, -23, 32, 23, 223, 232)
	
	//drop dash dust
	SpriteFrame(-19, -9, 19, 9, 256, 246)
	SpriteFrame(-20, -16, 20, 16, 283, 239)
	SpriteFrame(-21, -19, 21, 19, 314, 236)
	SpriteFrame(-22, -20, 22, 20, 347, 235)
	SpriteFrame(-24, -21, 24, 21, 379, 234)
	SpriteFrame(-25, -24, 25, 21, 412, 231)	
end event

event RSDKDraw
	DrawSprite(0)
end event

event RSDKLoad
	LoadSpriteSheet("Global/Display.gif")
	SpriteFrame(-16, -16, 32, 32, 1, 143)
end event
