By mjrb4 - uploaded on 2009-7-4 1134 views (93 in the last 7 days)
Tags: demo with-source
Here's a quick demo of the Wanderer helper class - actors that extend this class will be able to call setLocation even to go somewhere off screen. The co-ordinates are still stored, and when the actor enters the world again it will become visible.
This scenario is a member of the following collections: Reusable actors & support classes
Report this scenario as broken or inappropriate.
The Greenfoot Network: Greenfoot.org Greenfoot Gallery Greenfoot-Discuss
Ninto writes (on 2009-7-8):
Oh so that's why I can't drag my actors in my "Super Mario bros." scenario!
mjrb4 writes (on 2009-7-8):
Yup ;-)
limefortheworld writes (on 2009-7-27):
This is awesome! The code I'd need to make a better platform... :)
tombud999 writes (on 2009-8-8):
Hi, I would like to have this Wanderer effect in my Tossing scenario that using SmoothMover & Vector class. Which methods should I override?
mjrb4 writes (on 2009-8-8):
You just need to download the source and put the wanderer class in your scenario so it's a superclass of whatever you want to "wander." So if you put it in your project and then do something like:
public class Ball extends Wanderer
and then edit wanderer to extend whatever Ball was previously extending, it should work. (Obviously replace ball with whatever actor it is you want to wander outside the world!)
tombud999 writes (on 2009-8-9):
I just modified SmoothMoverWithGravity class to extends Wanderer class, and hey! it works perfectly! :D
Thanks alot, Michael !
limefortheworld writes (on 2009-8-17):
The collision doesn't work properly! how do I solve that problem?
limefortheworld writes (on 2009-8-18):
never mind... Maybe one can override the collision codes (get the code at the source code from some old version of greenfoot)
mjrb4 writes (on 2009-8-18):
Sorry, I haven't had a chance to test this out yet! Is it just with actors that extend the Wanderer class? I thought it worked ok for me when I tested it... I'll have another look at some point.
limefortheworld writes (on 2010-1-23):
I finally wrote codes to override collision offscreen! :D :D :D :D :D :D (one now can use the getOneIntersectingObject and other similar methods)
See all comments for this scenario.
If you want to leave a comment on this scenario, you must first log in.