aboutsummaryrefslogtreecommitdiff
path: root/particles.lua
diff options
context:
space:
mode:
author1029chris <1029chris@gmail.com>2022-02-02 17:13:53 -0800
committer1029chris <1029chris@gmail.com>2022-02-02 17:13:53 -0800
commit23383a22b2b1e0508053f9559f4174d7e163b103 (patch)
treef4666f7351bc8630bc00352cb9cbf7f188f3a3ee /particles.lua
parent6d84e60455afb5e45db773541ff4b96e91c06705 (diff)
Added circle particles, and more bullet stuff
Diffstat (limited to 'particles.lua')
-rw-r--r--particles.lua26
1 files changed, 26 insertions, 0 deletions
diff --git a/particles.lua b/particles.lua
new file mode 100644
index 0000000..29a8140
--- /dev/null
+++ b/particles.lua
@@ -0,0 +1,26 @@
+function addcircle(x, y, velx, vely, r, time, color)
+ local circle = {}
+ circle.x = x
+ circle.y = y
+ circle.velx = velx
+ circle.vely = vely
+ circle.r = r
+ circle.time = time
+ circle.t = time
+ circle.col = color
+
+ function circle.draw(circle)
+ circfill(circle.x, circle.y, circle.r*sin(circle.time/circle.t), circle.col)
+ end
+
+ function circle.update(circle)
+ circle.x += circle.velx
+ circle.y += circle.vely
+ circle.time -= 1/60
+ if circle.time < 0 then
+ del(obj, circle)
+ end
+ end
+
+ add(obj, circle)
+end \ No newline at end of file