[racket] WORLD manipulation doubt

From: Marco Morazan (morazanm at gmail.com)
Date: Thu May 1 14:47:48 EDT 2014

On Thu, May 1, 2014 at 1:26 PM, Zee Ken <udaybhasker552009 at gmail.com> wrote:

> Hi,
>
> I am creating a game which runs in the below world.
>
> (define-struct world (myself monster1 monster2 food1 food2))
>
> The objective of the game is to move yourself in the world, not get hit by
> monsters and eat the food.
>
> I am done with
> 1) Keyboard manipulation of *myself*,
> 2) Stopping the game when I hit any of the monsters (monsters move
> randomly in the world).
>
> *Question1:* Placing the food is also an easy task. But, how do I modify
> the world when I eat the food?
>
> I am thinking of writing a procedure that checks if the user hit a SPACE
> button and is also near the food. If both of these are true, then that
> particular food image at the location should disappear and the game should
> continue.
>


This is keyboard manipulation. Thus, you need to refine your handler for
key events to create, if necessary, a new world when the SPACE bar is
pressed.



>
> *Question2:* Also, are there any timer events in racket where I can
> include a stop clock counting down from a number to zero?
>
> I am a bit confused as to how I should tackle the idea.
>


This sounds like another varying component of the game. Thus, include it as
part of your world structure.

I hope this helps,

Marco



>
>
> Best,
> Zeek
>
> ____________________
>   Racket Users list:
>   http://lists.racket-lang.org/users
>
>


-- 

Cheers,

Marco

Have a´¨)
¸.·´¸.·*´¨) ¸.·*¨)
(¸.·´ (¸.·´ * wonderful day! :)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20140501/85bf22ce/attachment.html>

Posted on the users mailing list.