	
	[object_type]
	id=beetle_water
	prototype=ant
	traction_in_water=500

	[vars]
		points_value=5
		turns_at_cliffs=1
	[/vars]
		
		on_create="if(underwater,animation('swim'),animation('stand'))"
		on_enter_water="[set(has_feet, 0), animation('swim'),set(x_bound,x-100),set(x2_bound,x+100)]"
		on_exit_water="[set(has_feet, 1), animation('stand')]"
		on_process_swim="[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('swimturn')])]"

		on_end_swim_anim="animation('swim')"
		on_end_stand_anim="if(underwater,[animation('swim'),set(velocity_y,0)],%PROTO%)"
		on_end_swimturn_anim="animation('swim')"
		on_end_anim="if(not animation in ['swim','swimturn'],%PROTO%)"

		on_collide="if(underwater, [set(animation, 'swimturn'), set(facing, -facing), set(velocity_x, 0)], %PROTO%)"
		on_collide_feet="if(underwater, set(velocity_y, -velocity_y), %PROTO%)"

		[base:animation]
		image=enemies/beetle-water.png
		rotate_on_slope=yes
		pad=3
		accel_x=0
		accel_y=80
		body_area=all
		[/animation]
	
		[animation]
		id=stand
		[/animation]
	
		[animation]
		id=thrown
		[/animation]

		[animation]
		id=on_back
		[/animation]

		[animation]
		id=walk
		accel_x=250
		[/animation]

		[animation]
		id=walk
		duplicates=6
		accel_x=250
		rect=3,1,27,28
		[/animation]

		[animation]
		id=spring
		[/animation]

		[animation]
		id=turn
		[/animation]

		[animation]
		id=hurt
		[/animation]
	
		
		[animation]
		id=swim
		accel_x=30
		rect=3,96,37,119
		frames=4
		duration=5
		accel_y=0
		[/animation]
		
		[animation]
		id=swimturn
		rect=3,123,27,150
		frames=3
		duration=4
		accel_y=0
		[/animation]
		
	[/object_type]

