do - while loop - WAS:(RE: [Newbies] playfield limit)

Sandy Saline SSaline at sewardinc.com
Wed May 24 21:18:45 UTC 2006


Thanks for your thoughts. I solved it by putting borders inside the
playfield and adjusting the x and y if the rocket overlaps the border.
While I don't think it is the most elegant solution, it works.

Randy suggested enabling the fence. That appears to be the default
setting and doesn't seem to have an impact. Of course, it could be
something I am doing wrong.

I have added some explosives that need to be avoided and almost have
this working the way I want. I am stuck on how to make a do-while loop
in eToys. I know how to do it in squeak code based on Stef Ducasse's
Squeak book. When I typed this code into the textual code view and
convert to tiles I loose it. 

Can any one point me in the right direction?

Thanks so much.
Sandy




-----Original Message-----
From: beginners-bounces at lists.squeakfoundation.org
[mailto:beginners-bounces at lists.squeakfoundation.org] On Behalf Of Ron
Teitelbaum
Sent: Wednesday, May 24, 2006 9:16 AM
To: 'A friendly place to get answers to even the most basic
questionsaboutSqueak.'
Subject: RE: [Newbies] playfield limit


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

_______________________________________________
Beginners mailing list
Beginners at lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners


More information about the Beginners mailing list