blob: cd0138119a9ec9566c6f6c1184850fd683b4035f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
(use-modules (2d agenda)
(2d coroutine)
(2d game)
(2d sprite)
(2d vector2)
(2d window))
(load "common.scm")
(define window-width 640)
(define window-height 480)
(define sprite (load-sprite "images/p1_front.png"
#:position (vector2 320 240)))
;; Simple script that moves the sprite to a random location every
;; second.
(schedule-interval
(lambda ()
(set-sprite-position!
sprite
(vector2 (random window-width)
(random window-height))))
60)
(add-hook! draw-hook (lambda (dt alpha) (draw-sprite sprite)))
(with-window (make-window #:title "Coroutines"
#:resolution (vector2 window-width
window-height))
(run-game-loop))
|