aboutsummaryrefslogtreecommitdiff
path: root/turbo.scm
diff options
context:
space:
mode:
Diffstat (limited to 'turbo.scm')
-rw-r--r--turbo.scm14
1 files changed, 12 insertions, 2 deletions
diff --git a/turbo.scm b/turbo.scm
index db4a8ba..50d007f 100644
--- a/turbo.scm
+++ b/turbo.scm
@@ -7,10 +7,12 @@
;;;; Constants and variables
(define lane-height 65)
-(define lane-length 200)
+(define lane-length 192)
(define road-start-y 80)
(define road-section-position 0)
(define road (load-tileset "road.png" lane-length lane-height))
+(define grass (load-image "grass.png"))
+(define grass-height 96)
(define road-top (texture-atlas-ref road 2))
(define road-bottom (texture-atlas-ref road 0))
(define road-lane (texture-atlas-ref road 1))
@@ -41,11 +43,19 @@
(draw-lanes startx (+ lane-height starty) (- num-lanes 2))
(draw-sprite road-top (vec2 startx (+ starty (* lane-height (- num-lanes 1))))))
+(define (draw-grass-down x y)
+ (draw-sprite grass (vec2 x (- y grass-height))))
+
+(define (draw-grass-up x y)
+ (draw-sprite grass (vec2 x y)))
+
(define (draw-road startx starty num-lanes)
(if (< startx (window-width (current-window)))
(begin
+ (draw-grass-down startx starty)
(draw-road-section startx starty num-lanes)
- (draw-road (+ startx lane-length) starty num-lanes))))
+ (draw-road (+ startx lane-length) starty num-lanes)
+ (draw-grass-up startx (+ starty (* lane-height num-lanes))))))
(define (lane-y num-lane)
(+ road-start-y