Generalize drawing sprites
This commit is contained in:
parent
732f98d038
commit
2f9e663523
@ -80,6 +80,8 @@
|
|||||||
|
|
||||||
(defun game-input ()
|
(defun game-input ()
|
||||||
(when (rl:is-mouse-button-pressed 0)
|
(when (rl:is-mouse-button-pressed 0)
|
||||||
|
(setf (click-pos *game-state*) (print (rl:get-mouse-position))))
|
||||||
|
(when (rl:is-mouse-button-pressed 1)
|
||||||
(setf (click-pos *game-state*) (print (rl:get-mouse-position)))))
|
(setf (click-pos *game-state*) (print (rl:get-mouse-position)))))
|
||||||
;; (with-slots ((pos archer-pos) (kpos knight-pos)) *game-state*
|
;; (with-slots ((pos archer-pos) (kpos knight-pos)) *game-state*
|
||||||
;; (let ((dx 0.0) (dy 0.0))
|
;; (let ((dx 0.0) (dy 0.0))
|
||||||
@ -159,15 +161,15 @@
|
|||||||
(rl:clear-background (rl:make-rgba 71 171 169 1))
|
(rl:clear-background (rl:make-rgba 71 171 169 1))
|
||||||
(draw-ground)
|
(draw-ground)
|
||||||
(rl:draw-texture-v (gethash 'tower *textures*) (vec 80 150) :white)
|
(rl:draw-texture-v (gethash 'tower *textures*) (vec 80 150) :white)
|
||||||
(draw-sprite (sprite *knight*) (pos *knight*))
|
(dolist (entity (entities *game-state*))
|
||||||
(draw-sprite (sprite *archer*) (pos *archer*))
|
(draw-sprite (sprite entity) (pos entity)))
|
||||||
(rl:draw-fps 10 10))
|
(rl:draw-fps 10 10))
|
||||||
|
|
||||||
(defun game ()
|
(defun game ()
|
||||||
(let* ((screen-width 900)
|
(let* ((screen-width 900)
|
||||||
(screen-height 500))
|
(screen-height 500))
|
||||||
(rl:with-window (screen-width screen-height "RTS")
|
(rl:with-window (screen-width screen-height "RTS")
|
||||||
(rl:set-target-fps 120)
|
(rl:set-target-fps 240)
|
||||||
(game-init)
|
(game-init)
|
||||||
(loop :until (rl:window-should-close)
|
(loop :until (rl:window-should-close)
|
||||||
:do (livesupport:continuable (game-input)
|
:do (livesupport:continuable (game-input)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user