tuned physics to 60hz display refresh rate

This commit is contained in:
Peter Tillemans 2024-05-03 20:01:15 +02:00
parent 4fcd44dd92
commit 8c46f0f721
2 changed files with 3 additions and 5 deletions

View file

@ -20,4 +20,3 @@ A flappy bird clone to get experience with Common Lisp and game development.
- [X] Add high scores
- [X] Package for Mac/Linux/(Windows?)
- [ ] Create different levels

View file

@ -163,7 +163,6 @@ Hash-table with level name => file name => resource.")
(defun draw-image-layer(level resource scroll-x)
(let ((pic (serapeum:href *resources* level resource))
(offset (mod scroll-x 960)))
(print pic)
(draw (crop pic offset 0 960 540)
:x 0 :y 0 :width 960 :height 540)))
@ -196,8 +195,8 @@ Hash-table with level name => file name => resource.")
(ground-level 440)
(copy-pixels nil)
(ball (make-ball (/ width 10) (/ height 3) 0 10))
(gravity 0.025)
(flap-speed -1)
(gravity 0.1)
(flap-speed -3)
(ball-pen (make-pen :stroke (gray 0.5) :fill sketch:+yellow+ :weight 1))
(collision-pen (make-pen :stroke (gray 0.5) :fill sketch:+red+ :weight 1))
(pipe-pen (make-pen :stroke (gray 0.5) :fill sketch:+green+ :weight 1))
@ -206,7 +205,7 @@ Hash-table with level name => file name => resource.")
(pipes-width 20)
(pipes (random-pipes pipes-amount pipes-spacing ground-level 100 pipes-width))
(scroll-x 0.0)
(scroll-speed 0.2)
(scroll-speed 0.8)
(target-x (- (* pipes-amount pipes-spacing) 720))
(state 'new)
(score 0)