Testing arrow key controls
Co-authored-by: TakeV <TakeV-Lambda@users.noreply.github.com>
This commit is contained in:
parent
6ddf0853df
commit
4613bf58f3
2 changed files with 42 additions and 5 deletions
28
game.scm
28
game.scm
|
@ -62,7 +62,7 @@
|
|||
(hitbox paddle-hitbox))
|
||||
|
||||
(define-record-type <level>
|
||||
(make-level state bricks ball paddle score move-left? move-right?)
|
||||
(make-level state bricks ball paddle score move-left? move-right? move-up? move-down?)
|
||||
level?
|
||||
(state level-state set-level-state!) ; play, win, lose
|
||||
(bricks level-bricks)
|
||||
|
@ -70,7 +70,9 @@
|
|||
(paddle level-paddle)
|
||||
(score level-score set-level-score!)
|
||||
(move-left? level-move-left? set-level-move-left!)
|
||||
(move-right? level-move-right? set-level-move-right!))
|
||||
(move-right? level-move-right? set-level-move-right!)
|
||||
(move-up? level-move-up? set-level-move-up!)
|
||||
(move-down? level-move-down? set-level-move-up!))
|
||||
|
||||
;; Assets
|
||||
(define image:paddle (make-image "assets/images/paddle.png"))
|
||||
|
@ -133,7 +135,7 @@
|
|||
(/ paddle-width 2.0))
|
||||
(- game-height paddle-height 8.0)
|
||||
paddle-width paddle-height))
|
||||
0 #f #f))
|
||||
0 #f #f #f #f))
|
||||
|
||||
;; Game state
|
||||
(define *level* (make-level-1))
|
||||
|
@ -155,8 +157,10 @@
|
|||
|
||||
(define (update-paddle-velocity! level)
|
||||
(let ((speed (* paddle-speed
|
||||
(+ (if (level-move-left? level) -1.0 0.0)
|
||||
(if (level-move-right? level) 1.0 0.0)))))
|
||||
(+ (if (level-move-left? level) -1.0 0.0)
|
||||
(if (level-move-right? level) 1.0 0.0)
|
||||
(if (level-move-up? level) 0.0 1.0)
|
||||
(if (level-move-down? level) 0.0 -1.0)))))
|
||||
(set-vec2-x! (paddle-velocity (level-paddle level)) speed)))
|
||||
|
||||
(define (speed-up-ball! ball)
|
||||
|
@ -313,6 +317,8 @@
|
|||
;; Input
|
||||
(define key:left "ArrowLeft")
|
||||
(define key:right "ArrowRight")
|
||||
(define key:up "ArrowUp")
|
||||
(define key:down "ArrowDown")
|
||||
(define key:confirm "Enter")
|
||||
|
||||
(define (on-key-down event)
|
||||
|
@ -325,6 +331,12 @@
|
|||
(update-paddle-velocity! *level*))
|
||||
((string=? key key:right)
|
||||
(set-level-move-right! *level* #t)
|
||||
(update-paddle-velocity! *level*))
|
||||
((string=? key key:up)
|
||||
(set-level-move-up! *level* #t)
|
||||
(update-paddle-velocity! *level*))
|
||||
((string=? key key:down)
|
||||
(set-level-move-down! *level* #t)
|
||||
(update-paddle-velocity! *level*))))
|
||||
((or 'win 'lose)
|
||||
(when (string=? key key:confirm)
|
||||
|
@ -340,6 +352,12 @@
|
|||
(update-paddle-velocity! *level*))
|
||||
((string=? key key:right)
|
||||
(set-level-move-right! *level* #f)
|
||||
(update-paddle-velocity! *level*))
|
||||
((string=? key key:up)
|
||||
(set-level-move-up! *level* #f)
|
||||
(update-paddle-velocity! *level*))
|
||||
((string=? key key:down)
|
||||
(set-level-move-down! *level* #f)
|
||||
(update-paddle-velocity! *level*))))
|
||||
(_ #t))))
|
||||
|
||||
|
|
19
notes.md
Normal file
19
notes.md
Normal file
|
@ -0,0 +1,19 @@
|
|||
- Randomized rooms
|
||||
- Hades style proc-gen
|
||||
- Upgrade cards
|
||||
- Familiars
|
||||
- Different weapon options
|
||||
- Throwing potions
|
||||
- Philospher's MacGuffin
|
||||
- combine abilities
|
||||
- pixel art style
|
||||
- coins for store?
|
||||
- experience points?
|
||||
- interactive environment objects
|
||||
- explosive barrels
|
||||
- pyres / campfires / braziers / etc
|
||||
- elemental effects
|
||||
- fire : fire damage + burning effect
|
||||
- water : undoes fire ig lol, makes more conductive (amplifies electric damage?)
|
||||
- air : idk? wind damage? levitation? knockback?
|
||||
- earth : gets em stuck in a wall lmao
|
Loading…
Reference in a new issue