[plt-scheme] some more frtime questions

From: Dave Griffiths (dave at pawfal.org)
Date: Tue Jan 15 05:09:35 EST 2008

Hi Greg, all

So I've made a bit of progress with using fluxus via frtime. I've got
simple primitives working, and hooked up the keyboard and mouse via
events. I've started writing a little shoot-em-up to understand how to
actually use frtime, and it's proving to be good fun :)

A hopefully quite simple user question (still trying to not think
statefully)...

So I'm spawning bullets from my player object when the player presses the
'x' button like so:

; draw a bullet
(if (hold (map-e (lambda (key) (eq? key #\x)) keyboard) #f)
    (sphere
     #:colour (vector 1 0 1)
     #:scale (vector 0.1 0.1 2)
     #:translate (vector (vector-ref player-pos 0)
                         (vector-ref player-pos 1)
                         (integral -0.05))))

('sphere' is my stuff)

So, ok it only fires one bullet - but what I'd like to ask is how I can
keep the bullet after the x key has been released - for a set length of
time. I've tried playing with delay-by, but got a bit lost. Would delaying
the release keyboard message be the right approach? It seems it would be
more general to be able to give things a lifetime somehow.

Also I'd like to have the bullet move independantly after it's been
created (at the moment they move in relation to player-pos).

Are there some demos which do things like this? I had a look but couldn't
find any. I've put all my code so far here:
http://www.pawfal.org/index.php?page=FluxusFrisbee

cheers,

dave



Posted on the users mailing list.