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
23v.n = 0
24
25function init(me)
26
27end
28
29function update(me, dt)
30	if v.n == 0 then
31		v.n = getNaija()
32	end
33	if node_isEntityIn(me, v.n) then
34		entity_damage(v.n, 0, 0.5)
35
36		local nx, ny = getWallNormal(node_x(me), node_y(me))
37		if not(nx == 0 and ny == 0) then
38			nx, ny = vector_setLength(nx, ny, 800)
39			--entity_push(v.n, nx, ny, 0.25)
40			entity_addVel(v.n, nx, ny)
41		end
42	end
43end
44