root growth tweaks
This commit is contained in:
parent
d1dbef3f32
commit
a86bd6aa47
5 changed files with 34 additions and 24 deletions
|
@ -49,7 +49,7 @@
|
||||||
(define/public (setup)
|
(define/public (setup)
|
||||||
(lock-camera cam)
|
(lock-camera cam)
|
||||||
(camera-lag 0.2)
|
(camera-lag 0.2)
|
||||||
(clip 1 100)
|
(clip 1 300)
|
||||||
(set-camera-transform (mtranslate (vector 0 0 -4))))
|
(set-camera-transform (mtranslate (vector 0 0 -4))))
|
||||||
|
|
||||||
; moveme
|
; moveme
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
(define curl-amount 40)
|
(define curl-amount 40)
|
||||||
(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 4)
|
(define nutrient-twig-size-increase 2)
|
||||||
|
|
||||||
;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
; the base class logic object - all logic side objects can
|
; the base class logic object - all logic side objects can
|
||||||
|
@ -91,6 +91,9 @@
|
||||||
(define/public (get-dist)
|
(define/public (get-dist)
|
||||||
dist)
|
dist)
|
||||||
|
|
||||||
|
(define/public (get-w)
|
||||||
|
w)
|
||||||
|
|
||||||
(define/public (get-dir)
|
(define/public (get-dir)
|
||||||
dir)
|
dir)
|
||||||
|
|
||||||
|
@ -131,7 +134,8 @@
|
||||||
|
|
||||||
|
|
||||||
(set! w (if (zero? (- num-points 2)) width
|
(set! w (if (zero? (- num-points 2)) width
|
||||||
(+ 0.1 (* width (- 1 (/ (length points) (- num-points 2)))))))
|
(* width (- 1 (/ (length points) (- num-points 2))))))
|
||||||
|
(set! dist (* w 1.5))
|
||||||
(set! last-point new-point)
|
(set! last-point new-point)
|
||||||
(set! points (append points (list new-point)))
|
(set! points (append points (list new-point)))
|
||||||
(set! widths (append widths (list w)))
|
(set! widths (append widths (list w)))
|
||||||
|
@ -324,7 +328,7 @@
|
||||||
(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 '(leaf flower fork horn inflatoe)) ; a list of symbols - properties come from pickups
|
(properties '()) ; 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
|
||||||
|
|
|
@ -589,17 +589,23 @@
|
||||||
(let* ((twig-id (inexact->exact twig-id))
|
(let* ((twig-id (inexact->exact twig-id))
|
||||||
(twig (get-twig twig-id))
|
(twig (get-twig twig-id))
|
||||||
(point (inexact->exact point)))
|
(point (inexact->exact point)))
|
||||||
(if twig
|
|
||||||
(cond
|
(cond
|
||||||
((< point 1) (pdata-set! "twig" i -1) (vector 0 0 0))
|
((or (< point 1) (not twig))
|
||||||
|
(let* ((new-twig (choose twigs))
|
||||||
|
(num-points (send (cadr new-twig) get-num-points))
|
||||||
|
(new-point (if (zero? num-points) 0 (random num-points))))
|
||||||
|
(pdata-set! "twig" i (car new-twig))
|
||||||
|
(pdata-set! "point" i new-point)
|
||||||
|
(pdata-set! "offset" i (vmix offset (vmul (srndvec) (send (cadr new-twig) get-width new-point)) 0.2))
|
||||||
|
(send (cadr new-twig) get-point new-point)))
|
||||||
((< (vdist (vadd (send twig get-point point) offset) p) 0.1)
|
((< (vdist (vadd (send twig get-point point) offset) p) 0.1)
|
||||||
(pdata-set! "point" i (- point 1))
|
(pdata-set! "point" i (- point 1))
|
||||||
(vadd p (vmul (vnormalise (vsub (vadd (send twig get-point (- point 1)) offset) p)) (* speed d))))
|
(vadd p (vmul (vnormalise (vsub (vadd (send twig get-point (- point 1)) offset) p)) (* speed d))))
|
||||||
(else
|
(else
|
||||||
(vadd p (vmul (vnormalise (vsub (vadd (send twig get-point point) offset) p)) (* speed d)))))
|
(vadd p (vmul (vnormalise (vsub (vadd (send twig get-point point) offset) p)) (* speed d)))))))
|
||||||
(vector 0 0 0))))
|
|
||||||
"p" "twig" "point" "offset" "speed"))))
|
"p" "twig" "point" "offset" "speed"))))
|
||||||
|
|
||||||
|
|
||||||
(define/public (update t d)
|
(define/public (update t d)
|
||||||
(update-nutrients t d)
|
(update-nutrients t d)
|
||||||
(with-primitive seed
|
(with-primitive seed
|
||||||
|
|
|
@ -49,7 +49,7 @@
|
||||||
(lambda (_)
|
(lambda (_)
|
||||||
(make-ob 'seed 'seed "meshes/seed.obj"
|
(make-ob 'seed 'seed "meshes/seed.obj"
|
||||||
(vmul (srndvec) (* size area 0.5))
|
(vmul (srndvec) (* size area 0.5))
|
||||||
(* 0.5 50)
|
(* 0.3 50)
|
||||||
(vmul (rndvec) 0) 0)))
|
(vmul (rndvec) 0) 0)))
|
||||||
|
|
||||||
(build-list num-pickups
|
(build-list num-pickups
|
||||||
|
|
File diff suppressed because one or more lines are too long
Loading…
Reference in a new issue