Etoy issues

Andreas Raab andreas.raab at squeakland.org
Thu Jan 23 23:54:38 PST 2003


Hi Jahanzeb,

This problem can be very cleanly solved by separating out the individual
cases and write a script for each single one. Here is an example:

batman collideTop <ticking>
Test	batman's top color sees maze's color
  Yes batman's y decrease by batman's y speed

The above handles the case of colliding with the "top edge of batman" in
which case it takes the current y speed and applies it inversely to keep
batman within the maze (otherwise you would be able to go through the
walls). You can write similar scripts for bottom, left, and right. 

The above still isn't perfect because you will find that batman is going to
"vibrate" when he hits a wall. We should reset the speed when we bump into a
wall so that batman isn't going to repeatedly try to run into the wall,
e.g.,

batman collideTop <ticking>
Test	batman's top color sees maze's color
  Yes batman's y decrease by batman's y speed
      batman's yspeed <- 0.

The nice thing about writing individual ticking scripts is that it is easy
to test them individually and see if they are working correctly. And once
you got one of them going all the others follow naturally. Also note that at
this point your control script is really only concerned with the joystick
control which makes it a lot simpler to read and understand.

Hope this helps,
  - Andreas


> -----Original Message-----
> From: owner-squeakland at squeakland.org 
> [mailto:owner-squeakland at squeakland.org] On Behalf Of 
> Jahanzeb Sherwani
> Sent: Thursday, January 23, 2003 7:32 AM
> To: squeakland at squeakland.org
> Subject: Re: Etoy issues
> 
> 
> At 05:44 PM 1/22/2003 -0800, Alan Kay wrote:
> >Once this is done, then one only has to realize that a maze 
> is a kind 
> >of road ...
> 
> I've uploaded a project to the BSS super swiki called 
> '4-sensor maze'. It's
> not working as well as it should, so if anyone can improve 
> upon it, please
> do so and upload it back. My constraints were that it should be simple
> enough to make it easy to explain and understand, but 
> powerful enough to
> work properly. I don't think this solution meets either of these
> constraints, but it would be great if someone else can 
> improve upon it.
> 
> Jahanzeb
> 




More information about the Squeakland mailing list