summaryrefslogtreecommitdiff
path: root/src/player.fnl
diff options
context:
space:
mode:
authorubq323 <ubq323@ubq323.website>2022-05-06 00:14:49 +0100
committerubq323 <ubq323@ubq323.website>2022-05-06 00:14:49 +0100
commit7dd3caa70e641d7c6f72390d39c77a7bf2544746 (patch)
treeb1d1edbf7ee901ccb315f49bf8091b0f0f10690b /src/player.fnl
parentd6faf9716c167906c45deb099808d4d568e34c0d (diff)
more things
Diffstat (limited to 'src/player.fnl')
-rw-r--r--src/player.fnl34
1 files changed, 30 insertions, 4 deletions
diff --git a/src/player.fnl b/src/player.fnl
index 9ba457a..53ceb59 100644
--- a/src/player.fnl
+++ b/src/player.fnl
@@ -17,20 +17,46 @@
world (if ?world ?world
{:move (fn move [_1 _2 tx ty] (values tx ty))})]
(when (not= sf 0)
+ (if (> vx 0) (set self.left false)
+ (< vx 0) (set self.left true))
(let [vx (/ vx sf)
vy (/ vy sf)
tx (+ self.x (* vx dt speed))
ty (+ self.y (* vy dt speed))
(ax ay) (world:move :player tx ty)]
- (tset self :x ax)
- (tset self :y ay)))))
+ (set self.x ax)
+ (set self.y ay)))))
(fn C.draw [self]
+ (love.graphics.push)
+ (love.graphics.translate self.x self.y)
+ (if self.left
+ (love.graphics.scale -1 1))
+ (love.graphics.scale 0.1)
+
(love.graphics.setColor 0.91 0.62 0)
- (love.graphics.rectangle :fill self.x self.y 10 10))
+ (love.graphics.circle :fill 0 0 150)
+ (love.graphics.setColor 1 1 1)
+ (love.graphics.setLineWidth 4)
+ (love.graphics.circle :line 0 0 150)
+
+
+ (love.graphics.setColor 0 0 0)
+ (love.graphics.circle :fill 30 -80 20)
+ (love.graphics.circle :fill 100 -80 20)
+
+ (love.graphics.setLineWidth 20)
+ (love.graphics.line 40 50 0 70)
+ (love.graphics.line 120 50 150 70)
+
+
+ (love.graphics.pop))
+
+
+
(fn make []
- (let [s {:x 170 :y 150}]
+ (let [s {:x 170 :y 150 :left false}]
(setmetatable s C)
s))