[Newbies] playfield limit
aerowolf at gmail.com
Wed May 24 14:25:28 UTC 2006
For your next challenge, keep track of the actual X,Y coordinates
while displaying the ship at the outer edge of the field closest to
those X,Y coordinates. (If moving off the side of X is impractical,
set the horizontal velocity to 0 when the edge is hit.)
Or, if you're really desperate, do a log(10) of (X) velocity required
to reach that level of (Y), and multiply the ship's Y inertia by that
number. This will have the effect of being harder to move toward the
top of the field, and will more pessimistically model the effect of
'gravity acceleration' -- i.e., it's easy to fall, and not easy to
pull yourself out of it. (Whatever your gravitational constant is.)
Gah. I need to stop thinking, my brain hurts... or maybe it's how
bright the sun is today. :)
On 5/24/06, Ron Teitelbaum <Ron at usmedrec.com> wrote:
> 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?
> Beginners mailing list
> Beginners at lists.squeakfoundation.org
More information about the Beginners