//-------Aliases-------//


// Static Values

// Tables
public table Flower_Table1
	10176, 680, 4
	0, 0, 0
	0, 0, 0
	0, 0, 0
end table

public table Flower_Table2
	704, 680, 4
	1888, 712, 2
	2240, 680, 4
	3088, 776, 12
	
end table

event ObjectMain
	temp1 = object.propertyValue
	temp1 *= 8
	temp1 += 32
	temp2 = temp1
	FlipSign(temp1)
	foreach (GROUP_PLAYERS, currentPlayer, ACTIVE_ENTITIES)
		BoxCollisionTest(C_TOUCH, object.entityPos, temp1, -40, temp2, 40, currentPlayer, HITBOX_AUTO, HITBOX_AUTO, HITBOX_AUTO, HITBOX_AUTO)
		if checkResult == 1
			if object[currentPlayer].gravity == GRAVITY_AIR
				object[currentPlayer].value18 = 5
			else				
				object[currentPlayer].value18 = 4
			end if
		else
			temp1 -= 32
			temp2 += 32
			BoxCollisionTest(C_TOUCH, object.entityPos, temp1, -72, temp2, 72, currentPlayer, HITBOX_AUTO, HITBOX_AUTO, HITBOX_AUTO, HITBOX_AUTO)
			if checkResult == 1
				object[currentPlayer].value18 = 4			
			end if
		end if
	next
end event


event ObjectDraw
	if object[0].type == TypeName[Debug Mode]
		temp1 = object.xpos
		temp1 >>= 16
		temp2 = object.propertyValue
		temp2 *= 8
		temp1 -= temp2
		temp1 <<= 16
		temp2 = 0
		while temp2 < object.propertyValue
			DrawSpriteXY(0, temp1, object.ypos
			temp1 += 0x10 0000
			temp2++
		loop
	end if
end event


event ObjectStartup
	switch stage.actNum
	case 1
	case 3
		temp0 = Flower_Table1
		break
	case 2
		temp0 = Flower_Table2
		break
	end switch
	temp1 = 0
	arrayPos0 = 600
	while temp1 < 12
	
		GetTableValue(temp2, temp1, temp0)
		temp1++
		GetTableValue(temp3, temp1, temp0)
		temp1++
		GetTableValue(temp4, temp1, temp0)
		temp1++
		if temp4 > 0
			temp2 <<= 16
			temp3 <<= 16
			ResetObjectEntity(arrayPos0, TypeName[Flower Saver], temp4, temp2, temp3)
			object[arrayPos0].drawOrder = 6
			arrayPos0++
		end if
	loop
	LoadSpriteSheet("Global/Display.gif")
	SpriteFrame(0, -8, 16, 16, 127, 113)
end event

event RSDKDraw
	DrawSprite(0)
end event

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