[Newbies] playfield limit

Ron Teitelbaum Ron at USMedRec.com
Wed May 24 14:15:57 UTC 2006


Hi Sandy,

I was hoping someone else that has more experience with eToys would answer
your question.  Since nobody spoke up I decided to try it for myself.  I
have to tell you it was a lot of fun!

I did a few things that sort of worked so I thought I'd share with you what
I did.

The first thing I thought of was to limit the height of the ship by creating
a script that said if you go above the top of the play field then set the Y
coordinate to the top of the play field.  This didn't work very well as I'm
sure you found out.  It was kinda fun in that when you get to the limit it
does slow down, but right after it sets the ship to the top boundary, it
increases the position by the ySpeed variable, so off the top it shoots.

My next thought was to have some kind of escape velocity which would make it
harder and harder to move past the top.  This would have the effect of
slowing down the ship before it reached the top.  This was worked ok too,
but allowed the ship to fall much too quickly once the acceleration was 0.


I then thought maybe if we set the top to reset to the top minus the ySpeed
then it would bounce off the top with bigger bounces the higher the
acceleration is.  This was ok but kinda annoying.

I tried setting the ySpeed to 1 when the ship reached the top and this gave
it a much more pleasing bounce.  But it still has the same problem of
loosing too much acceleration at the top and falling like a rock when you
ease up.

Try your own variations and feel free to let us know what you came up with.
I'm interested.  

Maybe someone else can make some suggestions.  For the bottom I recommend
you create a blown up ship that displays if you hit the ground!

Anyway I had fun!!  I hope this helped some,

Ron Teitelbaum
President / Principal Software Engineer
US Medical Record Specialists
Ron at USMedRec.com  
________________________________________
From: Sandy Saline
Sent: Tuesday, May 23, 2006 5:17 PM

I built the Lunar Lander project from the squeakland.org website. Now I am
trying to add some more functionality on my own.

How do I force the rocket to stay within the playfield? I am guessing the
solution involves obtrudes or bounce but so far my attempts have failed. 

Also, how do I put a background graphic inside the playfield?

Thanks
Sandy



More information about the Beginners mailing list