1-- Copyright (C) 2007, 2010 - Bit-Blot
2--
3-- This file is part of Aquaria.
4--
5-- Aquaria is free software; you can redistribute it and/or
6-- modify it under the terms of the GNU General Public License
7-- as published by the Free Software Foundation; either version 2
8-- of the License, or (at your option) any later version.
9--
10-- This program is distributed in the hope that it will be useful,
11-- but WITHOUT ANY WARRANTY; without even the implied warranty of
12-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13--
14-- See the GNU General Public License for more details.
15--
16-- You should have received a copy of the GNU General Public License
17-- along with this program; if not, write to the Free Software
18-- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
19
20if not v then v = {} end
21if not AQUARIA_VERSION then dofile("scripts/entities/entityinclude.lua") end
22
23-- skeletal test
24
25
26-- ================================================================================================
27-- L O C A L  V A R I A B L E S
28-- ================================================================================================
29
30
31v.swimTime = 0.75
32v.swimTimer = v.swimTime - v.swimTime/4
33
34-- ================================================================================================
35-- FUNCTIONS
36-- ================================================================================================
37
38function init()
39	setupBasicEntity(
40	"",								-- texture
41	6,								-- health
42	1,								-- manaballamount
43	1,								-- exp
44	1,								-- money
45	28,								-- collideRadius
46	STATE_IDLE,						-- initState
47	128,							-- sprite width
48	128,							-- sprite height
49	1,								-- particle "explosion" type, maps to particleEffects.txt -1 = none
50	1,								-- 0/1 hit other entities off/on (uses collideRadius)
51	4000							-- updateCull -1: disabled, default: 4000
52	)
53
54	--entity_scale(0.5, 0.5)
55	entity_initSkeletal("mer", "drask")
56	entity_animate("swim", -1)
57end
58
59function update(dt)
60	if not entity_hasTarget() then
61		entity_findTarget(1000)
62	else
63		if entity_hasTarget() then
64			if entity_isTargetInRange(64) then
65				entity_hurtTarget(1);
66--				entity_moveTowardsTarget(dt, -1000)
67			end
68		end
69
70		--[[
71		v.swimTimer = v.swimTimer + dt
72		if v.swimTimer > v.swimTime then
73			entity_moveTowardsTarget(1, 400)
74			entity_doCollisionAvoidance(1, 6, 0.5);
75			entity_doEntityAvoidance(1, 256, 0.2);
76			entity_rotateToVel(0.2)
77			v.swimTimer = v.swimTimer - v.swimTime
78		else
79			entity_moveTowardsTarget(dt, 100)
80			entity_doEntityAvoidance(dt, 64, 0.1);
81			entity_doCollisionAvoidance(dt, 6, 0.5);
82		end
83		]]--
84		entity_moveTowardsTarget(dt, 1000)
85		entity_rotateToVel(0.1)
86		entity_doCollisionAvoidance(dt, 6, 0.5)
87	end
88
89	--entity_doFriction(dt, 700)
90	entity_updateMovement(dt)
91end
92
93function enterState()
94	if entity_getState()==STATE_IDLE then
95		entity_setMaxSpeed(200)
96	end
97end
98
99function exitState()
100end
101
102function hitSurface()
103end
104