summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--game.scm18
-rw-r--r--images/background.asebin0 -> 2359 bytes
-rw-r--r--images/background.pngbin0 -> 1129 bytes
-rw-r--r--images/player-bullet.asebin439 -> 422 bytes
-rw-r--r--index.html1
5 files changed, 17 insertions, 2 deletions
diff --git a/game.scm b/game.scm
index 8200f3d..5a6f586 100644
--- a/game.scm
+++ b/game.scm
@@ -233,13 +233,14 @@
;; Screen size stuff
(define game-width 240.0)
(define game-height 320.0)
- (define canvas-scale 2.0)
+ (define canvas-scale 3.0)
(define canvas-width (* game-width canvas-scale))
(define canvas-height (* game-height canvas-scale))
;; Elements
(define canvas (get-element-by-id "canvas"))
(define context (get-context canvas "2d"))
+ (define image:background (get-element-by-id "image-background"))
(define image:player (get-element-by-id "image-player"))
(define image:player-bullet (get-element-by-id "image-player-bullet"))
(define image:enemy-bullets (get-element-by-id "image-enemy-bullets"))
@@ -805,12 +806,25 @@
(define (draw-enemy-bullets)
(draw-bullets enemy-bullets image:enemy-bullets 16.0 16.0))
+ (define (draw-background image parallax)
+ (let ((scroll (remainder (* *scroll* parallax) game-height)))
+ ;; Bottom
+ (draw-image context image:background
+ 0.0 0.0 game-width (- game-height scroll)
+ 0.0 scroll game-width (- game-height scroll))
+ ;; Top
+ (draw-image context image:background
+ 0.0 (- game-height scroll) game-width scroll
+ 0.0 0.0 game-width scroll)
+ ))
+
(define (draw time)
(clear-screen)
(set-transform! context 1.0 0.0 0.0 1.0 0.0 0.0)
(set-scale! context canvas-scale canvas-scale)
- (set-fill-color! context demichrome0)
+ (set-fill-color! context "#3f2832")
(fill-rect context 0.0 0.0 game-width game-height)
+ (draw-background image:background 0.75)
(draw-tiles level)
;; (draw-tiles level 0.0)
(draw-player-bullets)
diff --git a/images/background.ase b/images/background.ase
new file mode 100644
index 0000000..93a3150
--- /dev/null
+++ b/images/background.ase
Binary files differ
diff --git a/images/background.png b/images/background.png
new file mode 100644
index 0000000..00db1c4
--- /dev/null
+++ b/images/background.png
Binary files differ
diff --git a/images/player-bullet.ase b/images/player-bullet.ase
index 19af10d..5e7a8cf 100644
--- a/images/player-bullet.ase
+++ b/images/player-bullet.ase
Binary files differ
diff --git a/index.html b/index.html
index 499bf49..162fc93 100644
--- a/index.html
+++ b/index.html
@@ -7,6 +7,7 @@
<body>
<canvas id="canvas"></canvas>
<div style="display:none;">
+ <img id="image-background" src="images/background.png" />
<img id="image-player" src="images/player.png" />
<img id="image-player-bullet" src="images/player-bullet.png" />
<img id="image-enemy-bullets" src="images/enemy-bullets.png" />