[prototype]
feet_width="4"
friction="1000"
has_feet="no"
hitpoints="2"
id="platform_mosquito"
mass="5"
on_collide="[set(facing, -facing),animation('turn'),set(velocity_x,0)]"
on_collide_object_body="if(collide_with.vars.team != vars.team and collide_with_area = 'attack',
			if(not (me in collide_with.tmp.already_hit), [set(collide_with.tmp, 'already_hit', collide_with.tmp.already_hit + [me]),
		
				set(hitpoints, hitpoints - collide_with.vars.damage), animation('hurt'), set(green, 100), set(blue, 100), set(velocity_x,600 * collide_with.facing)]))"
on_create="animation('fly')"
on_die="[score(level,points_value), spawn_item(self), spawn('die_cloud', midpoint_x, midpoint_y, facing)]"
on_end_anim="animation('fly')"
on_end_hurt_anim="animation('fly')"
on_end_turn_anim="animation('fly')"
on_enter_anim="set(tmp, 'already_hit', [])"
on_hurtflicker="if(green = 100,[set(green, 255), set(blue, 255)],[set(green, 100), set(blue, 100)])"
on_jumped_on="[if(jumped_on_by.mass >= 1000, die(), animation('spring'))]"
on_leave_hurt_anim="[set(green, 255), set(blue, 255)]"
on_surface_damage="die()"
on_timer="if(solid(level, front + facing*50, y, 1, y2 - y) or (facing < 0 and x < vars.x_bound) or (facing > 0 and x2 > vars.x2_bound),
	[facing(-facing), animation('turn')])"
platform_area="5,10,25,11"
solid_area="2,12,30,28"
springiness="100"
timer_frequency="2"
traction="1000"
traction_in_air="1000"
	[properties]
	get_hit_by="def(collide_with) execute(me,
	             if(not (me in collide_with.tmp.already_hit), [
				set(collide_with.tmp, 'already_hit', collide_with.tmp.already_hit + [me]),
				if((not is_invincible_posthit) and (collide_with.vars.damage > 0),
					if(collide_with.vars.damage > consts.armor,
					  [
					   if(me.hitpoints > collide_with.vars.damage,
						[
						  if(collide_with.vars.damage <= consts.flinch_threshold,
							schedule(4, [set(me.green, 255), set(me.blue, 255)]),
							set(me.animation, 'hurt')),
						  set(me.green, 100), set(me.blue, 100)
						]),
					   set(me.hitpoints, me.hitpoints - collide_with.vars.damage),
					   set(tmp.time_last_hit, me.cycle)
					  ])),
				if(collide_with.vars.damage > consts.flinch_threshold and me.hurt_velocity_y and (not collide_with.tmp.no_flinch_attack), set(me.velocity_y,(me.hurt_velocity_y))),
				if(collide_with.vars.damage > consts.flinch_threshold and me.hurt_velocity_x and (not collide_with.tmp.no_flinch_attack), set(me.velocity_x, ((me.hurt_velocity_x * collide_with.facing + collide_with.velocity_x/2)*collide_with.mass*if(collide_with.attack_force, collide_with.attack_force, 100))/(me.mass*100)))]))"
	hurt_velocity_x="400"
	hurt_velocity_y="-800"
	is_invincible_posthit="if(tmp.time_last_hit and (abs(tmp.time_last_hit - me.cycle) < consts.posthit_invicibility_period), 1, 0)"
	[/properties]

	[tmp]
	time_last_hit="0"
	[/tmp]

	[vars]
	damage="1"
	points_value="5"
	team="'evil'"
	[/vars]

	[properties]
	hurt_velocity_y="0"
	[/properties]

	[animation]
	accel_x="10"
	attack_area="15,18,26,26"
	body_area="all"
	duration="6"
	frame_info="4,9,1,4,475,369,26,18,3,8,1,4,501,369,27,19"
	frames="2"
	id="fly"
	image="compiled-2.png"
	rect="471,360,501,390"
	[/animation]

	[animation]
	body_area="all"
	duration="6"
	frame_info="4,9,1,4,475,369,26,18,3,8,1,4,501,369,27,19"
	frames="2"
	id="spring"
	image="compiled-2.png"
	rect="471,360,501,390"
	[/animation]

	[animation]
	attack_area="0,18,26,26"
	body_area="all"
	duration="10"
	frame_info="6,9,6,4,929,389,19,18"
	frames="1"
	id="turn"
	image="compiled-2.png"
	rect="923,380,953,410"
	[/animation]

	[animation]
	body_area="all"
	duration="18"
	events="6:12:18:hurtflicker"
	frame_info="4,9,1,4,903,389,26,18"
	frames="1"
	id="hurt"
	image="compiled-2.png"
	rect="899,380,929,410"
	[/animation]

[/prototype]

