dofile("scripts/entities/bloodcell-common.lua")

function init(me)
	commonInit(me, "bloodcell-red")
	
	esetv(me, EV_TYPEID, EVT_CELLRED)

	
	--entity_setEntityLayer(me, 0)
end

function update(me, dt)
	commonUpdate(me, dt)
	
	if entity_isEntityInRange(me, n, 40) then 
		if not avatar_isBursting() then
			entity_setPosition(me, entity_x(n), entity_y(n), 0.1)
		elseif avatar_isRolling() then
			entity_moveTowardsTarget(me, dt, -800)
		end
	end

	rangeNode = entity_getNearestNode(me, "KILLENTITY")
	if node_isPositionIn(rangeNode, entity_x(me), entity_y(me)) then
		entity_setState(me, STATE_DIE)
	end
end
