Re: Can a Morph / (etoys player) follow a connector path ?
karl ramberg <[email protected]>
| Newsgroups | gmane.comp.lang.smalltalk.squeak.squeakland |
|---|---|
| Message-ID | <CAGzzWLjACdfRC_jwfn=UTvgBtu=gXiNDA2h9vjr4S0YYmsXN+w@mail.gmail.com> |
I made a version of this here http://squeakland.org/showcase/project.jsp?id=11816 Click in the green playfields to create markers. Start the plane with the Go button Karl On Fri, Mar 16, 2012 at 10:24 PM, Steve Thomas <sthomas1-gQhbkF4bah9Wk0Htik3J/[email protected]>wrote: > Mike, > > No high level method I know of to track a connector. But there are many > wonderful things inside Etoys which I have not yet discovered. > > So lets break down the game a bit. You have to detect clicking on a > particular plane (this can be done setting a script for each plane to > execute on a mouse down event). > Then you have to "draw a path to the target" and that path is not always a > straight line. > And you have to make sure the plane you clicked follows the path you drew > for it, not another planes path (assuming you are making a multi-plane > game). > > Well lets start simple with a single plane version. > > First let's assume only a plane and target. When you click on the plane > you can get a script to execute by setting the scripts "when to run" to > "Mouse down" (in the script editor, click on normal and you will get a list > of options). > [image: Inline image 1] > > Now once you click on the script you would need to start "drawing the path" > One way to do this would be to create a copy of a "marker" (pick any > object you want to use as your marker) and have it follow your mouse > movements. For the script below I created my plane on the page of a book > (I like doing this as I can duplicate pages for different versions as I > play and explore). The script below was started with the "mouse down" on > the plane from the script above. > > [image: Inline image 2] > > Then when you click again you would want to stop the marker from following > the mouse. > [image: Inline image 3] > > Now of course you would need to create copies of these markers and keep > track of them for each plane (a holder would be a good way to keep track of > them). And to show the path you could use connectors connecting your plane > to the markers. > > There are a number of more "advanced" Etoys features you would need to use > but if you can play around with the above and want to go further, please > send more questions to the list and we'll be glad to help. > > Stephen > > On Fri, Mar 16, 2012 at 1:09 PM, Mike Stramba <[email protected]>wrote: > >> I'd like to do something similar to this game in Squeak / Etoys >> >> http://www.gamenet.com/game/air-traffic-chief/ >> >> I.e. using a connector, having the motion of a morph follow that >> connector, as the connector is moved while the morph is moving. >> >> I see the demos in Etoys of a "car following a road", but they seem >> to be tracking a particular color, and continually turning left or >> right (which is ya, basically what any path finding program is gonna >> have to do internally, I guess). >> >> Wondering if there is a "high level" / class / etoys .. method etc, >> to track a connector >> >> Mike >> _______________________________________________ >> squeakland mailing list >> [email protected] >> http://lists.squeakland.org/mailman/listinfo/squeakland >> > > > _______________________________________________ > squeakland mailing list > [email protected] > http://lists.squeakland.org/mailman/listinfo/squeakland > > _______________________________________________ squeakland mailing list [email protected] http://lists.squeakland.org/mailman/listinfo/squeakland
Picture 2.png
(image/png, 12.7 KB) - not displayed
Picture 3.png
(image/png, 10.4 KB) - not displayed
Picture 1.png
(image/png, 10.2 KB) - not displayed