aboutsummaryrefslogtreecommitdiff
path: root/virus1.lua
diff options
context:
space:
mode:
author1029chris <1029chris@gmail.com>2016-04-20 10:19:52 -0700
committer1029chris <1029chris@gmail.com>2016-04-20 10:19:52 -0700
commit5b9e47c1f86fbcd910d96b5d5c76c5d3b7fbf31c (patch)
tree4bc7be62c9967ba6d9c8694b297d1301416bf81a /virus1.lua
parent04890d4e9ef8dc4c1e8578d037c456b12464e89d (diff)
Virus now moves smoothly
Also added global time variable
Diffstat (limited to 'virus1.lua')
-rw-r--r--virus1.lua1
1 files changed, 1 insertions, 0 deletions
diff --git a/virus1.lua b/virus1.lua
index b6d3f66..9eb0a85 100644
--- a/virus1.lua
+++ b/virus1.lua
@@ -62,6 +62,7 @@ function drawVirusFight1()
v1.c.xd = sys.w/2
v1.c.yd = sys.h/2
end
+ v1.c.sp = math.sqrt(math.abs(v1.c.xd - v1.c.x)*2 + math.abs(v1.c.yd - v1.c.y)*2)/5
v1.c.angle = math.atan2((v1.c.yd - v1.c.y), (v1.c.xd - v1.c.x))
v1.c.spx = v1.c.sp * math.cos(v1.c.angle)
v1.c.spy = v1.c.sp * math.sin(v1.c.angle)