butterflies, spiders, pretty twiglets, new pickups
This commit is contained in:
parent
be2bd4ba1f
commit
dca225bc0a
12 changed files with 1083 additions and 287 deletions
|
@ -27,7 +27,8 @@
|
||||||
(seed-return #f)
|
(seed-return #f)
|
||||||
(seed-return-timer 0)
|
(seed-return-timer 0)
|
||||||
(seed-return-secs-per-point 3)
|
(seed-return-secs-per-point 3)
|
||||||
(twig-stack '()))
|
(twig-stack '())
|
||||||
|
(above-ground #f))
|
||||||
|
|
||||||
(define/public (set-player-plant s)
|
(define/public (set-player-plant s)
|
||||||
(set! pos (send s get-pos))
|
(set! pos (send s get-pos))
|
||||||
|
@ -49,7 +50,6 @@
|
||||||
(define/public (setup)
|
(define/public (setup)
|
||||||
(lock-camera cam)
|
(lock-camera cam)
|
||||||
(camera-lag 0.2)
|
(camera-lag 0.2)
|
||||||
(clip 1 300)
|
|
||||||
(set-camera-transform (mtranslate (vector 0 0 -4))))
|
(set-camera-transform (mtranslate (vector 0 0 -4))))
|
||||||
|
|
||||||
; moveme
|
; moveme
|
||||||
|
@ -144,6 +144,16 @@
|
||||||
(set! seed-return #t)
|
(set! seed-return #t)
|
||||||
(set! current-point (- (send current-twig get-num-points) 1)))
|
(set! current-point (- (send current-twig get-num-points) 1)))
|
||||||
|
|
||||||
|
(cond
|
||||||
|
((and (not above-ground) (> (vy (vadd player-pos pos)) 0))
|
||||||
|
(set! above-ground #t)
|
||||||
|
(send game-view above-ground)
|
||||||
|
(printf "up~n"))
|
||||||
|
((and above-ground (< (vy (vadd player-pos pos)) 0))
|
||||||
|
(set! above-ground #f)
|
||||||
|
(send game-view below-ground)
|
||||||
|
(printf "down~n")))
|
||||||
|
|
||||||
(let* ((side (vnormalise (vcross up fwd)))
|
(let* ((side (vnormalise (vcross up fwd)))
|
||||||
(up (vnormalise (vcross fwd side))))
|
(up (vnormalise (vcross fwd side))))
|
||||||
|
|
||||||
|
|
|
@ -13,25 +13,28 @@
|
||||||
(players (list
|
(players (list
|
||||||
(make-player-info "plant0000001@fo.am" "plant0000001"
|
(make-player-info "plant0000001@fo.am" "plant0000001"
|
||||||
"textures/plant0000001.png" (list-ref (list-ref seed-obs 0) 2)
|
"textures/plant0000001.png" (list-ref (list-ref seed-obs 0) 2)
|
||||||
(vector 0.5 1 0.5))
|
(vector 0.5 0.5 0.5))
|
||||||
(make-player-info "plant0000002@fo.am" "plant0000002"
|
(make-player-info "plant0000002@fo.am" "plant0000002"
|
||||||
"textures/plant0000002.png" (list-ref (list-ref seed-obs 1) 2)
|
"textures/plant0000002.png" (list-ref (list-ref seed-obs 1) 2)
|
||||||
(vector 0.5 1 0))
|
(vector 0.25 0.25 0.25))
|
||||||
(make-player-info "plant0000003@fo.am" "plant0000003"
|
(make-player-info "plant0000003@fo.am" "plant0000003"
|
||||||
"textures/plant0000003.png" (list-ref (list-ref seed-obs 2) 2)
|
"textures/plant0000003.png" (list-ref (list-ref seed-obs 2) 2)
|
||||||
(vector 0 1 0.5))
|
(vector 0.7 0.7 0.7))
|
||||||
(make-player-info "plant0000004@fo.am" "plant0000004"
|
(make-player-info "plant0000004@fo.am" "plant0000004"
|
||||||
"textures/plant0000004.png" (list-ref (list-ref seed-obs 3) 2)
|
"textures/plant0000004.png" (list-ref (list-ref seed-obs 3) 2)
|
||||||
(vector 0.75 1 0.5))
|
(vector 0.75 0.75 0.75))
|
||||||
(make-player-info "plant0000005@fo.am" "plant0000005"
|
(make-player-info "plant0000005@fo.am" "plant0000005"
|
||||||
"textures/plant0000005.png" (list-ref (list-ref seed-obs 4) 2)
|
"textures/plant0000005.png" (list-ref (list-ref seed-obs 4) 2)
|
||||||
(vector 0.5 1 0.75))
|
(vector 0.1 0.1 0.1))
|
||||||
))
|
))
|
||||||
(seeds '())
|
(seeds '())
|
||||||
(clicked -1))
|
(clicked -1))
|
||||||
|
|
||||||
(define/public (get-player-info)
|
(define/public (get-player-info)
|
||||||
(list-ref players clicked))
|
(list-ref players clicked))
|
||||||
|
|
||||||
|
(define/public (get-players)
|
||||||
|
players)
|
||||||
|
|
||||||
(define/public (setup)
|
(define/public (setup)
|
||||||
(let ((c 0))
|
(let ((c 0))
|
||||||
|
@ -87,15 +90,28 @@
|
||||||
(player #f)
|
(player #f)
|
||||||
(logic-tick 0.5)) ; time between logic updates
|
(logic-tick 0.5)) ; time between logic updates
|
||||||
|
|
||||||
(define/public (setup pi)
|
(define/public (setup pi players)
|
||||||
(set! cl (make-object client% (player-info-jid pi) (player-info-pass pi)))
|
(set! cl (make-object client% (player-info-jid pi) (player-info-pass pi)))
|
||||||
(set! player (make-object plant-logic%
|
(set! player (make-object plant-logic%
|
||||||
(player-info-jid pi)
|
(player-info-jid pi)
|
||||||
(player-info-pos pi)
|
(player-info-pos pi)
|
||||||
(player-info-col pi)
|
(player-info-col pi)
|
||||||
(player-info-tex pi)))
|
(player-info-tex pi)
|
||||||
|
#t))
|
||||||
(send c set-player-plant player)
|
(send c set-player-plant player)
|
||||||
(send gl add-player player)
|
(send gl add-player player)
|
||||||
|
|
||||||
|
; add the other players...
|
||||||
|
(for-each
|
||||||
|
(lambda (player)
|
||||||
|
(when (not (eq? player pi))
|
||||||
|
(send gl add-plant (make-object plant-logic%
|
||||||
|
(player-info-jid player)
|
||||||
|
(player-info-pos player)
|
||||||
|
(player-info-col player)
|
||||||
|
(player-info-tex player)))))
|
||||||
|
players)
|
||||||
|
|
||||||
(send c setup)
|
(send c setup)
|
||||||
(send gv setup world-list)
|
(send gv setup world-list)
|
||||||
(send gl setup world-list)
|
(send gl setup world-list)
|
||||||
|
@ -105,7 +121,7 @@
|
||||||
(when (< tick-time t)
|
(when (< tick-time t)
|
||||||
|
|
||||||
|
|
||||||
(let ((messages (send gl update)))
|
(let ((messages (send gl update t d)))
|
||||||
; pass the messages to the network client
|
; pass the messages to the network client
|
||||||
(send gv update t d (send cl update messages gl))) ; and the game view
|
(send gv update t d (send cl update messages gl))) ; and the game view
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#lang scheme/base
|
#lang scheme/base
|
||||||
(require scheme/class openssl (prefix-in xmpp: "xmpp.ss"))
|
(require scheme/class); openssl (prefix-in xmpp: "xmpp.ss"))
|
||||||
(provide (all-defined-out))
|
(provide (all-defined-out))
|
||||||
|
|
||||||
; a class which wraps the xmpp in a thread and allows messages to be picked up
|
; a class which wraps the xmpp in a thread and allows messages to be picked up
|
||||||
|
@ -36,9 +36,9 @@
|
||||||
(define/public (send-msg to msg)
|
(define/public (send-msg to msg)
|
||||||
(set! outgoing (append outgoing (list (list to msg)))))
|
(set! outgoing (append outgoing (list (list to msg)))))
|
||||||
|
|
||||||
(define (message-handler sz)
|
(define (message-handler sz) 0)
|
||||||
(when debug-jab (printf "rx <---- ~a ~a~n" (xmpp:message-from sz) (xmpp:message-body sz)))
|
; (when debug-jab (printf "rx <---- ~a ~a~n" (xmpp:message-from sz) (xmpp:message-body sz)))
|
||||||
(set! incoming (cons (list (xmpp:message-from sz) (xmpp:message-body sz)) incoming)))
|
;(set! incoming (cons (list (xmpp:message-from sz) (xmpp:message-body sz)) incoming)))
|
||||||
|
|
||||||
(define/public (start)
|
(define/public (start)
|
||||||
(set! thr (thread run)))
|
(set! thr (thread run)))
|
||||||
|
@ -46,8 +46,8 @@
|
||||||
(define/public (stop)
|
(define/public (stop)
|
||||||
(kill-thread thr))
|
(kill-thread thr))
|
||||||
|
|
||||||
(define (run)
|
(define (run) 0
|
||||||
(xmpp:with-xmpp-session jid pass
|
#;(xmpp:with-xmpp-session jid pass
|
||||||
(xmpp:set-xmpp-handler 'message message-handler)
|
(xmpp:set-xmpp-handler 'message message-handler)
|
||||||
(let loop ()
|
(let loop ()
|
||||||
(when debug-netloop (printf ".~n"))
|
(when debug-netloop (printf ".~n"))
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
(define start-twig-points 15)
|
(define start-twig-points 15)
|
||||||
(define start-twig-dist 0.05)
|
(define start-twig-dist 0.05)
|
||||||
(define start-twig-width 0.1)
|
(define start-twig-width 0.1)
|
||||||
(define default-max-twigs 5)
|
(define default-max-twigs 2)
|
||||||
(define default-scale-factor 1.05)
|
(define default-scale-factor 1.05)
|
||||||
(define num-pickups 10)
|
(define num-pickups 10)
|
||||||
(define pickup-dist-radius 200)
|
(define pickup-dist-radius 200)
|
||||||
|
@ -19,6 +19,12 @@
|
||||||
(define start-size 50)
|
(define start-size 50)
|
||||||
(define max-ornaments 10) ; per twig
|
(define max-ornaments 10) ; per twig
|
||||||
(define nutrient-twig-size-increase 2)
|
(define nutrient-twig-size-increase 2)
|
||||||
|
(define num-worms 10)
|
||||||
|
(define num-spiders 10)
|
||||||
|
(define num-butterflies 10)
|
||||||
|
(define auto-twig-var 5)
|
||||||
|
(define auto-time 5)
|
||||||
|
(define pickup-check-prob 20)
|
||||||
|
|
||||||
;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
; the base class logic object - all logic side objects can
|
; the base class logic object - all logic side objects can
|
||||||
|
@ -41,8 +47,8 @@
|
||||||
((list? (car l)) (append (flatten (car l)) (flatten (cdr l))))
|
((list? (car l)) (append (flatten (car l)) (flatten (cdr l))))
|
||||||
(else (cons (car l) (flatten (cdr l))))))
|
(else (cons (car l) (flatten (cdr l))))))
|
||||||
|
|
||||||
(define/pubment (update) ; need to augement this if we have child logic objects,
|
(define/pubment (update t d) ; need to augement this if we have child logic objects,
|
||||||
(let ((l (inner '() update)) ; and call update on them too.
|
(let ((l (inner '() update t d)) ; and call update on them too.
|
||||||
(m messages))
|
(m messages))
|
||||||
(set! messages '())
|
(set! messages '())
|
||||||
(append
|
(append
|
||||||
|
@ -51,6 +57,62 @@
|
||||||
|
|
||||||
(super-new)))
|
(super-new)))
|
||||||
|
|
||||||
|
;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
(define insect-logic%
|
||||||
|
(class game-logic-object%
|
||||||
|
(init-field
|
||||||
|
(id 0)
|
||||||
|
(pos 0)
|
||||||
|
(type 'none)
|
||||||
|
(d (if (eq? type 'worm) (+ 20 (* 20 (rndf)))
|
||||||
|
(+ 10 (* 2 (rndf)))))) ; time to get from one place to another
|
||||||
|
|
||||||
|
(field
|
||||||
|
(next-update 0)
|
||||||
|
(centre (vector 0 0 0)))
|
||||||
|
|
||||||
|
(inherit send-message)
|
||||||
|
|
||||||
|
(define/public (get-id)
|
||||||
|
id)
|
||||||
|
|
||||||
|
(define/public (get-pos)
|
||||||
|
pos)
|
||||||
|
|
||||||
|
(define/public (get-type)
|
||||||
|
type)
|
||||||
|
|
||||||
|
(define/public (set-centre s)
|
||||||
|
(set! centre s))
|
||||||
|
|
||||||
|
(define (move)
|
||||||
|
; todo check stones
|
||||||
|
(let ((speed (if (eq? type 'worm) 5 50)))
|
||||||
|
(if (> (vdist pos centre) 100)
|
||||||
|
(set! pos (vadd pos (vmul (vnormalise (vsub centre pos)) speed)))
|
||||||
|
(set! pos (vadd pos (vmul (srndvec) speed))))
|
||||||
|
;(when (< (vdist pos centre) 12) (move))
|
||||||
|
(when (and (or (eq? type 'spider) (eq? type 'worm)) (> (vy pos) 0))
|
||||||
|
(set! pos (vector (vx pos) 0 (vz pos))))
|
||||||
|
(when (and (eq? type 'butterfly) (< (vy pos) 50))
|
||||||
|
(set! pos (vector (vx pos) 50 (vz pos))))))
|
||||||
|
|
||||||
|
(define/augment (update time delta)
|
||||||
|
(cond ((> time next-update)
|
||||||
|
(move)
|
||||||
|
; todo: drop stuff
|
||||||
|
;(when (zero? (random pickup-drop-probability))
|
||||||
|
; (send cell set-pickup! 'default))
|
||||||
|
(set! next-update (+ time d))
|
||||||
|
(send-message 'insect-move (list
|
||||||
|
(list 'insect-id id)
|
||||||
|
(list 'pos pos)
|
||||||
|
(list 'duration d)))))
|
||||||
|
'())
|
||||||
|
|
||||||
|
(super-new)))
|
||||||
|
|
||||||
;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
; a twig, which can contain other twigs things.
|
; a twig, which can contain other twigs things.
|
||||||
; (roots and shoots are both twigs)
|
; (roots and shoots are both twigs)
|
||||||
|
@ -245,15 +307,15 @@
|
||||||
twigs)
|
twigs)
|
||||||
found)))
|
found)))
|
||||||
|
|
||||||
(define/augment (update)
|
(define/augment (update t d)
|
||||||
(append
|
(append
|
||||||
(map
|
(map
|
||||||
(lambda (ornament)
|
(lambda (ornament)
|
||||||
(send (cadr ornament) update))
|
(send (cadr ornament) update t d))
|
||||||
ornaments)
|
ornaments)
|
||||||
(map
|
(map
|
||||||
(lambda (twig)
|
(lambda (twig)
|
||||||
(send (cadr twig) update))
|
(send (cadr twig) update t d))
|
||||||
twigs)))
|
twigs)))
|
||||||
|
|
||||||
(super-new)))
|
(super-new)))
|
||||||
|
@ -323,19 +385,25 @@
|
||||||
(id #f)
|
(id #f)
|
||||||
(pos (vector 0 0 0))
|
(pos (vector 0 0 0))
|
||||||
(col (vector 1 1 1))
|
(col (vector 1 1 1))
|
||||||
(tex "fff"))
|
(tex "fff")
|
||||||
|
(is-player #f))
|
||||||
|
|
||||||
(field
|
(field
|
||||||
(twigs '()) ; a assoc list map of ids to twigs
|
(twigs '()) ; a assoc list map of ids to twigs
|
||||||
(leader-twig #f) ; the temporary twig controlled by the player
|
(leader-twig #f) ; the temporary twig controlled by the player
|
||||||
(properties '()) ; a list of symbols - properties come from pickups
|
(properties '(flower)) ; a list of symbols - properties come from pickups
|
||||||
(ornaments '()) ; map of ids to ornaments on the plant
|
(ornaments '()) ; map of ids to ornaments on the plant
|
||||||
(size start-size) ; the age of this plant
|
(size start-size) ; the age of this plant
|
||||||
(max-twigs default-max-twigs) ; the maximum twigs allowed at any time - oldest removed first
|
(max-twigs default-max-twigs) ; the maximum twigs allowed at any time - oldest removed first
|
||||||
(next-twig-id 0)
|
(next-twig-id 0)
|
||||||
(next-ornament-id 0)
|
(next-ornament-id 0)
|
||||||
(grow-amount default-scale-factor)
|
(grow-amount default-scale-factor)
|
||||||
(twig-size start-twig-points))
|
(twig-size start-twig-points)
|
||||||
|
(auto-pilot-t 0)
|
||||||
|
(auto-pilot-d (* (+ 1 (rndf)) auto-time))
|
||||||
|
(auto-twig #f)
|
||||||
|
(auto-twig-dir (hsrndvec))
|
||||||
|
(auto-twig-pos (vector 0 0 0)))
|
||||||
|
|
||||||
(inherit send-message)
|
(inherit send-message)
|
||||||
|
|
||||||
|
@ -384,8 +452,9 @@
|
||||||
next-ornament-id))
|
next-ornament-id))
|
||||||
|
|
||||||
(define/public (check-pickup pickup)
|
(define/public (check-pickup pickup)
|
||||||
(when leader-twig
|
(when (or is-player (random pickup-check-prob)) ; reduce the frequency for non-player plants
|
||||||
(send leader-twig check-pickup pickup))
|
(when leader-twig
|
||||||
|
(send leader-twig check-pickup pickup))
|
||||||
|
|
||||||
#;(foldl
|
#;(foldl
|
||||||
(lambda (twig found)
|
(lambda (twig found)
|
||||||
|
@ -394,7 +463,7 @@
|
||||||
(send (cadr twig) check-pickup pickup))
|
(send (cadr twig) check-pickup pickup))
|
||||||
#f))
|
#f))
|
||||||
#f
|
#f
|
||||||
twigs))
|
twigs)))
|
||||||
|
|
||||||
(define/public (destroy-twig twig)
|
(define/public (destroy-twig twig)
|
||||||
(send-message 'shrink-twig
|
(send-message 'shrink-twig
|
||||||
|
@ -461,7 +530,24 @@
|
||||||
(send (cadr twig) serialise))
|
(send (cadr twig) serialise))
|
||||||
twigs))))
|
twigs))))
|
||||||
|
|
||||||
(define/augment (update)
|
(define/public (run-auto-pilot t d)
|
||||||
|
(when (> t auto-pilot-t)
|
||||||
|
(set! auto-pilot-t (+ t auto-pilot-d))
|
||||||
|
(when (or (not auto-twig) (not (send auto-twig growing?)))
|
||||||
|
(set! auto-twig (make-object twig-logic% (vector 0 0 0) 0 this 'root
|
||||||
|
auto-twig-dir
|
||||||
|
start-twig-width
|
||||||
|
twig-size
|
||||||
|
'ribbon))
|
||||||
|
(set! auto-twig-dir (hsrndvec))
|
||||||
|
(set! auto-twig-pos auto-twig-dir)
|
||||||
|
(add-twig auto-twig))
|
||||||
|
(set! auto-twig-dir (vmul (vnormalise (vadd auto-twig-dir (vmul (srndvec) auto-twig-var)))
|
||||||
|
(send auto-twig get-dist)))
|
||||||
|
(set! auto-twig-pos (vadd auto-twig-pos auto-twig-dir))
|
||||||
|
(grow auto-twig-pos)))
|
||||||
|
|
||||||
|
(define/augment (update t d)
|
||||||
; grow a new ornament?
|
; grow a new ornament?
|
||||||
(when (and (not (null? properties)) (zero? (random ornament-grow-probability)))
|
(when (and (not (null? properties)) (zero? (random ornament-grow-probability)))
|
||||||
(let ((twig (get-random-twig)))
|
(let ((twig (get-random-twig)))
|
||||||
|
@ -479,7 +565,7 @@
|
||||||
point-index))))))
|
point-index))))))
|
||||||
(map
|
(map
|
||||||
(lambda (twig)
|
(lambda (twig)
|
||||||
(send (cadr twig) update))
|
(send (cadr twig) update t d))
|
||||||
twigs))
|
twigs))
|
||||||
|
|
||||||
(super-new)))
|
(super-new)))
|
||||||
|
@ -491,7 +577,8 @@
|
||||||
(field
|
(field
|
||||||
(plants '())
|
(plants '())
|
||||||
(pickups '())
|
(pickups '())
|
||||||
(player #f))
|
(player #f)
|
||||||
|
(insects '()))
|
||||||
|
|
||||||
(inherit send-message)
|
(inherit send-message)
|
||||||
|
|
||||||
|
@ -503,10 +590,16 @@
|
||||||
(add-pickup (make-object pickup-logic% i (list-ref pickup 0)
|
(add-pickup (make-object pickup-logic% i (list-ref pickup 0)
|
||||||
(list-ref pickup 2)))
|
(list-ref pickup 2)))
|
||||||
(set! i (+ i 1)))
|
(set! i (+ i 1)))
|
||||||
pickups))))
|
pickups)
|
||||||
|
(for ((id (in-range 0 num-worms)))
|
||||||
|
(add-insect (make-object insect-logic% id (vmul (srndvec) 100) 'worm)))
|
||||||
|
(for ((id (in-range 0 num-spiders)))
|
||||||
|
(add-insect (make-object insect-logic% (+ id num-worms) (vmul (srndvec) 100) 'spider)))
|
||||||
|
(for ((id (in-range 0 num-butterflies)))
|
||||||
|
(add-insect (make-object insect-logic% (+ id num-worms num-butterflies) (vmul (srndvec) 100) 'butterfly)))
|
||||||
|
)))
|
||||||
|
|
||||||
(define/public (add-player plant)
|
(define/public (add-player plant)
|
||||||
(printf "new player plant added ~a~n" (send plant get-id))
|
|
||||||
(send-message 'player-plant (list
|
(send-message 'player-plant (list
|
||||||
(list 'plant-id (send plant get-id))
|
(list 'plant-id (send plant get-id))
|
||||||
(list 'pos (send plant get-pos))
|
(list 'pos (send plant get-pos))
|
||||||
|
@ -514,7 +607,12 @@
|
||||||
(list 'col (send plant get-col))
|
(list 'col (send plant get-col))
|
||||||
(list 'tex (send plant get-tex))))
|
(list 'tex (send plant get-tex))))
|
||||||
(set! player plant)
|
(set! player plant)
|
||||||
(set! plants (cons plant plants)))
|
(set! plants (cons plant plants))
|
||||||
|
|
||||||
|
(for-each
|
||||||
|
(lambda (insect)
|
||||||
|
(send insect set-centre (send plant get-pos)))
|
||||||
|
insects))
|
||||||
|
|
||||||
(define/public (add-plant plant)
|
(define/public (add-plant plant)
|
||||||
(send-message 'new-plant (list
|
(send-message 'new-plant (list
|
||||||
|
@ -532,20 +630,40 @@
|
||||||
(list 'type (send pickup get-type))
|
(list 'type (send pickup get-type))
|
||||||
(list 'pos (send pickup get-pos))))
|
(list 'pos (send pickup get-pos))))
|
||||||
(set! pickups (cons pickup pickups)))
|
(set! pickups (cons pickup pickups)))
|
||||||
|
|
||||||
|
(define/public (add-insect insect)
|
||||||
|
(send-message 'new-insect (list
|
||||||
|
(list 'insect-id (send insect get-id))
|
||||||
|
(list 'pos (send insect get-pos))
|
||||||
|
(list 'type (send insect get-type))))
|
||||||
|
(send insect set-centre (send player get-pos))
|
||||||
|
(set! insects (cons insect insects)))
|
||||||
|
|
||||||
(define/public (serialise)
|
(define/public (serialise)
|
||||||
(send player serialise))
|
(send player serialise))
|
||||||
|
|
||||||
|
|
||||||
|
(define/public (run-auto-pilot t d)
|
||||||
|
(for-each
|
||||||
|
(lambda (plant)
|
||||||
|
(when (not (eq? plant player))
|
||||||
|
(send plant run-auto-pilot t d)))
|
||||||
|
plants))
|
||||||
|
|
||||||
|
|
||||||
; todo - distribute the checking of stuff like
|
; todo - distribute the checking of stuff like
|
||||||
; this to a random selection of pickups/plants
|
; this to a random selection of pickups/plants
|
||||||
; to distribute the cpu load
|
; to distribute the cpu load
|
||||||
(define/augment (update)
|
(define/augment (update t d)
|
||||||
|
|
||||||
|
(run-auto-pilot t d)
|
||||||
|
|
||||||
(for-each
|
(for-each
|
||||||
(lambda (pickup)
|
(lambda (pickup)
|
||||||
(for-each
|
(for-each
|
||||||
(lambda (plant)
|
(lambda (plant)
|
||||||
(send plant check-pickup pickup))
|
(send plant check-pickup pickup))
|
||||||
plants))
|
plants))
|
||||||
pickups)
|
pickups)
|
||||||
|
|
||||||
; remove the pickups that have been 'picked up'
|
; remove the pickups that have been 'picked up'
|
||||||
|
@ -554,9 +672,14 @@
|
||||||
(not (send pickup picked-up?)))
|
(not (send pickup picked-up?)))
|
||||||
pickups))
|
pickups))
|
||||||
|
|
||||||
(map
|
(append
|
||||||
(lambda (plant)
|
(map
|
||||||
(send plant update))
|
(lambda (plant)
|
||||||
plants))
|
(send plant update t d))
|
||||||
|
plants)
|
||||||
|
(map
|
||||||
|
(lambda (insect)
|
||||||
|
(send insect update t d))
|
||||||
|
insects)))
|
||||||
|
|
||||||
(super-new)))
|
(super-new)))
|
||||||
|
|
BIN
plant-eyes/meshes/butterfly.blend
Normal file
BIN
plant-eyes/meshes/butterfly.blend
Normal file
Binary file not shown.
103
plant-eyes/meshes/butterfly.obj
Normal file
103
plant-eyes/meshes/butterfly.obj
Normal file
|
@ -0,0 +1,103 @@
|
||||||
|
# Blender3D v245 OBJ File: butterfly.blend
|
||||||
|
# www.blender3d.org
|
||||||
|
o butterfly_Mesh
|
||||||
|
v 0.022483 0.000002 -0.790792
|
||||||
|
v 0.286519 0.000002 -0.808224
|
||||||
|
v 0.569586 0.000002 -0.813275
|
||||||
|
v 1.053234 0.000002 -0.802641
|
||||||
|
v 1.513902 0.000002 -0.768308
|
||||||
|
v 1.995211 0.000002 -0.662639
|
||||||
|
v 2.293338 0.000002 -0.513493
|
||||||
|
v 2.242126 0.000002 -0.382030
|
||||||
|
v 2.075995 0.000002 -0.176237
|
||||||
|
v 1.843004 0.000002 -0.029013
|
||||||
|
v 1.573859 0.000002 0.086073
|
||||||
|
v 1.118858 0.000002 0.190916
|
||||||
|
v 0.741962 0.000002 0.295921
|
||||||
|
v 0.771135 0.000002 0.497448
|
||||||
|
v 0.756951 0.000002 0.640671
|
||||||
|
v 0.596358 0.000002 0.745205
|
||||||
|
v 0.434684 0.000002 0.768079
|
||||||
|
v 0.244420 0.000002 0.751611
|
||||||
|
v 0.089934 0.000002 0.663155
|
||||||
|
v 0.042516 0.000002 0.533723
|
||||||
|
v 0.014988 0.000002 0.400845
|
||||||
|
vt 0.455701 0.993275 0.0
|
||||||
|
vt 0.243421 1.000000 0.0
|
||||||
|
vt 0.119179 0.996805 0.0
|
||||||
|
vt 0.119179 0.996805 0.0
|
||||||
|
vt 0.003289 0.985782 0.0
|
||||||
|
vt 0.455701 0.993275 0.0
|
||||||
|
vt 0.455701 0.993275 0.0
|
||||||
|
vt 0.003289 0.985782 0.0
|
||||||
|
vt 0.689145 0.995001 0.0
|
||||||
|
vt 0.837582 0.995001 0.0
|
||||||
|
vt 0.003289 0.985782 0.0
|
||||||
|
vt 0.011719 0.552540 0.0
|
||||||
|
vt 1.001961 0.943805 0.0
|
||||||
|
vt 0.837582 0.995001 0.0
|
||||||
|
vt 0.011719 0.552540 0.0
|
||||||
|
vt 1.000000 0.810426 0.0
|
||||||
|
vt 1.001961 0.943805 0.0
|
||||||
|
vt 0.011719 0.552540 0.0
|
||||||
|
vt 1.004866 0.699950 0.0
|
||||||
|
vt 1.000000 0.810426 0.0
|
||||||
|
vt 0.011719 0.552540 0.0
|
||||||
|
vt 1.002261 0.585438 0.0
|
||||||
|
vt 1.004866 0.699950 0.0
|
||||||
|
vt 0.011719 0.552540 0.0
|
||||||
|
vt 1.001561 0.484525 0.0
|
||||||
|
vt 1.002261 0.585438 0.0
|
||||||
|
vt 0.011719 0.552540 0.0
|
||||||
|
vt 0.996710 0.400030 0.0
|
||||||
|
vt 1.001561 0.414213 0.0
|
||||||
|
vt 0.972656 0.439259 0.0
|
||||||
|
vt 0.988410 0.279043 0.0
|
||||||
|
vt 0.996710 0.400030 0.0
|
||||||
|
vt 0.964844 0.361134 0.0
|
||||||
|
vt 0.998766 0.161859 0.0
|
||||||
|
vt 0.992316 0.173574 0.0
|
||||||
|
vt 0.937500 0.251759 0.0
|
||||||
|
vt 0.777196 0.206295 0.0
|
||||||
|
vt 0.600329 0.755609 0.0
|
||||||
|
vt 0.015625 0.501759 0.0
|
||||||
|
vt 0.777196 0.206295 0.0
|
||||||
|
vt 0.007812 0.540821 0.0
|
||||||
|
vt 0.008176 0.464606 0.0
|
||||||
|
vt 0.657689 0.072756 0.0
|
||||||
|
vt 0.777196 0.206295 0.0
|
||||||
|
vt 0.008176 0.464606 0.0
|
||||||
|
vt 0.657689 0.072756 0.0
|
||||||
|
vt 0.008176 0.464606 0.0
|
||||||
|
vt 0.028988 0.304632 0.0
|
||||||
|
vt 0.505172 0.010559 0.0
|
||||||
|
vt 0.657689 0.072756 0.0
|
||||||
|
vt 0.025082 0.304632 0.0
|
||||||
|
vt 0.505172 0.010559 0.0
|
||||||
|
vt 0.021176 0.304632 0.0
|
||||||
|
vt 0.030388 0.026039 0.0
|
||||||
|
vt 0.438117 0.003906 0.0
|
||||||
|
vt 0.665328 0.002746 0.0
|
||||||
|
vt 0.100701 0.010414 0.0
|
||||||
|
vn 0.000000 1.000000 -0.000000
|
||||||
|
usemtl None_butterfly.png
|
||||||
|
s off
|
||||||
|
f 4/1/1 3/2/1 2/3/1
|
||||||
|
f 2/4/1 1/5/1 4/6/1
|
||||||
|
f 4/7/1 1/8/1 5/9/1
|
||||||
|
f 5/10/1 1/11/1 21/12/1
|
||||||
|
f 6/13/1 5/14/1 21/15/1
|
||||||
|
f 7/16/1 6/17/1 21/18/1
|
||||||
|
f 8/19/1 7/20/1 21/21/1
|
||||||
|
f 9/22/1 8/23/1 21/24/1
|
||||||
|
f 10/25/1 9/26/1 21/27/1
|
||||||
|
f 11/28/1 10/29/1 21/30/1
|
||||||
|
f 12/31/1 11/32/1 21/33/1
|
||||||
|
f 13/34/1 12/35/1 21/36/1
|
||||||
|
f 14/37/1 13/38/1 21/39/1
|
||||||
|
f 14/40/1 21/41/1 20/42/1
|
||||||
|
f 15/43/1 14/44/1 20/45/1
|
||||||
|
f 15/46/1 20/47/1 19/48/1
|
||||||
|
f 16/49/1 15/50/1 19/51/1
|
||||||
|
f 16/52/1 19/53/1 18/54/1
|
||||||
|
f 17/55/1 16/56/1 18/57/1
|
69
plant-eyes/meshes/butterfly.svg
Normal file
69
plant-eyes/meshes/butterfly.svg
Normal file
|
@ -0,0 +1,69 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||||
|
<svg
|
||||||
|
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||||
|
xmlns:cc="http://creativecommons.org/ns#"
|
||||||
|
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||||
|
xmlns:svg="http://www.w3.org/2000/svg"
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||||
|
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||||
|
width="744.09448819"
|
||||||
|
height="1052.3622047"
|
||||||
|
id="svg2"
|
||||||
|
sodipodi:version="0.32"
|
||||||
|
inkscape:version="0.46"
|
||||||
|
sodipodi:docname="butterfly.svg"
|
||||||
|
inkscape:output_extension="org.inkscape.output.svg.inkscape">
|
||||||
|
<defs
|
||||||
|
id="defs4">
|
||||||
|
<inkscape:perspective
|
||||||
|
sodipodi:type="inkscape:persp3d"
|
||||||
|
inkscape:vp_x="0 : 526.18109 : 1"
|
||||||
|
inkscape:vp_y="0 : 1000 : 0"
|
||||||
|
inkscape:vp_z="744.09448 : 526.18109 : 1"
|
||||||
|
inkscape:persp3d-origin="372.04724 : 350.78739 : 1"
|
||||||
|
id="perspective10" />
|
||||||
|
</defs>
|
||||||
|
<sodipodi:namedview
|
||||||
|
id="base"
|
||||||
|
pagecolor="#ffffff"
|
||||||
|
bordercolor="#666666"
|
||||||
|
borderopacity="1.0"
|
||||||
|
gridtolerance="10000"
|
||||||
|
guidetolerance="10"
|
||||||
|
objecttolerance="10"
|
||||||
|
inkscape:pageopacity="0.0"
|
||||||
|
inkscape:pageshadow="2"
|
||||||
|
inkscape:zoom="0.7"
|
||||||
|
inkscape:cx="375"
|
||||||
|
inkscape:cy="520"
|
||||||
|
inkscape:document-units="px"
|
||||||
|
inkscape:current-layer="layer1"
|
||||||
|
showgrid="false"
|
||||||
|
inkscape:window-width="645"
|
||||||
|
inkscape:window-height="717"
|
||||||
|
inkscape:window-x="0"
|
||||||
|
inkscape:window-y="25" />
|
||||||
|
<metadata
|
||||||
|
id="metadata7">
|
||||||
|
<rdf:RDF>
|
||||||
|
<cc:Work
|
||||||
|
rdf:about="">
|
||||||
|
<dc:format>image/svg+xml</dc:format>
|
||||||
|
<dc:type
|
||||||
|
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||||
|
</cc:Work>
|
||||||
|
</rdf:RDF>
|
||||||
|
</metadata>
|
||||||
|
<g
|
||||||
|
inkscape:label="Layer 1"
|
||||||
|
inkscape:groupmode="layer"
|
||||||
|
id="layer1">
|
||||||
|
<path
|
||||||
|
style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
|
||||||
|
d="M 235.71428,273.79076 C 254.90915,270.64427 315.96816,269.50504 340,269.50504 C 421.01141,269.11452 444.82891,272.44383 520,278.07647 C 575.79111,290.85363 659.33671,302.82084 668.57143,326.64789 C 671.77064,334.64592 653.15086,364.04446 627.14286,390.93361 C 594.26,410.92531 573.50029,429.10984 531.42857,440.93361 C 482.10711,455.49717 402.32808,466.32873 372.85715,480.93361 C 374.52787,514.27008 385.06319,528.12923 375.71428,546.64789 C 355.38533,569.88117 334.88967,568.45444 314.28571,570.93362 C 292.75817,575.1478 261.00591,565.01549 248.57143,550.93361 C 238.33599,532.98879 239.46617,519.75441 234.28571,500.93361"
|
||||||
|
id="path2383"
|
||||||
|
sodipodi:nodetypes="ccccccccccc" />
|
||||||
|
</g>
|
||||||
|
</svg>
|
After Width: | Height: | Size: 2.7 KiB |
|
@ -44,6 +44,7 @@
|
||||||
|
|
||||||
(clear)
|
(clear)
|
||||||
(clear-shader-cache)
|
(clear-shader-cache)
|
||||||
|
(clear-texture-cache)
|
||||||
|
|
||||||
(define mode 'gui)
|
(define mode 'gui)
|
||||||
(define gui (make-object gui-game-mode% (list-ref world-list 0)))
|
(define gui (make-object gui-game-mode% (list-ref world-list 0)))
|
||||||
|
@ -60,7 +61,7 @@
|
||||||
(cond
|
(cond
|
||||||
((eq? mode 'gui)
|
((eq? mode 'gui)
|
||||||
(when (send gui update (flxtime) (delta))
|
(when (send gui update (flxtime) (delta))
|
||||||
(send game setup (send gui get-player-info))
|
(send game setup (send gui get-player-info) (send gui get-players))
|
||||||
(set! mode 'game)))
|
(set! mode 'game)))
|
||||||
((eq? mode 'game)
|
((eq? mode 'game)
|
||||||
(send game update (flxtime) (delta))))
|
(send game update (flxtime) (delta))))
|
||||||
|
|
BIN
plant-eyes/textures/butterfly.png
Normal file
BIN
plant-eyes/textures/butterfly.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 15 KiB |
BIN
plant-eyes/textures/ribbon-twig.png
Normal file
BIN
plant-eyes/textures/ribbon-twig.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.8 KiB |
Binary file not shown.
Before Width: | Height: | Size: 398 KiB After Width: | Height: | Size: 88 KiB |
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue