-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathobject.lua
More file actions
61 lines (52 loc) · 895 Bytes
/
object.lua
File metadata and controls
61 lines (52 loc) · 895 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
--
--tile object implimented in lua
--
--- Must have these varibles
x=0;
y=0;
z=0;
image_name="ship1";
delete_this=0;
persistant=0;
no_collide=1;
id_type="lua_tile";
--- Other varibles
counter=0;
function init ()--, z, image_name, blank)
end
-- 2 | 1
-- -- --
-- 3 | 0
function move( dir, speed )
if dir==0 then
x=x+speed;
elseif dir==1 then
y=y-speed;
elseif dir==2 then
x=x-speed;
elseif dir==3 then
y=y+speed;
end
end
function update()
counter=counter+1;
if (counter >= 0 and counter < 30) then
move(0,3);
elseif (counter >= 30 and counter < 60) then
move(3,3);
elseif (counter >= 60 and counter < 90) then
counter=0;
end
if (x < 0) then
x=320; --C function map_width()
end
if (y < 0) then
x=240; --C function map_height()
end
if (x > 320) then
x=0; --C function map_width()
end
if (y > 240) then
y=0; --C function map_height()
end
end