This site requires JavaScript, please enable it in your browser!
Greenfoot back

Comments for boundless-actor-test

Return to boundless-actor-test

ZergZerg

2009/11/25

this could be useful...
TheJHTheJH

2009/11/25

mjrb4 already wrote something like this... http://greenfootgallery.org/scenarios/818 http://greenfootgallery.org/collections/4
MTKMTK

2009/11/25

I noticed that it was a common problem around here so I decided to play around with it because I thought that not letting actors out the visible part of the world was a serious limitation of Greenfoot. Maybe I can play around with scrolling sometime later!
MTKMTK

2009/11/25

And I forgot to say that one side effect of this technique is that you can't drag the actors when the scenario is paused. The initial placement works normally, however.
BlackholeGFBlackholeGF

2009/11/25

Nice! My ecobear scenario uses a much more complex method of scrolling, which isn't as smooth.
Builderboy2005Builderboy2005

2009/11/25

There is a fix for draging the object between acts. In the setLocation method, put in a call to super.setLocation(#,#) and then set your variables. This also helps with collision detection i believe.
Jesusgeek94Jesusgeek94

2009/11/25

isnt this just using the wanderer helper class on the greenfoot website?
MTKMTK

2009/11/25

Builderboy2005: There is a fix for draging the object between acts. In the setLocation method, put in a call to super.setLocation(#,#) and then set your variables. This also helps with collision detection i believe. If Greenfoot thinks the objects are against the edge when they are actually far away, won't collision detection be all wrong?
MTKMTK

2009/11/25

I see that when I don't use super.setLocation, collision doesn't work at all, but when I do, it works as if the object is against the wall (when is is actually far out of view), which would to some serious bugs in even a simple game.
Builderboy2005Builderboy2005

2009/11/25

Well, i would think having partial collision detection would be better than no collision detection at all, but i guess its all up to you. ...Unless you are willing to overide all of the collision methods as well XD
kenshinakhkenshinakh

2009/11/25

Well there's a way to do full collisions, and anything else even when the actors do not "appear" in the world. I think someone in the codepoint-general section showed something like that in his scenario. The way I figure is that it is made by overriding/creating a method that checks for collisions based on the x-y coordinates instead of the actual picture.
Builderboy2005Builderboy2005

2009/11/25

Yeah, that would have to be the way to do it.
MTKMTK

2009/11/25

That seems like a good way to do collisions.
jrlowejrlowe

2012/11/11

an easier way to do this is under the world constructor... public (WorldName) { super( 600, 400, 1, false); } you can just add false to the end of the parameter and it disables boundaries.
SPowerSPower

2012/11/11

@MTK what jrlowe says is indeed better, since collision detection won't get updated when you move.