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

2015/1/8

Using danpost's SWorld for vertical srolling

Ruvero Ruvero

2015/1/8

#
I'm trying to use danpost's Scrolling SuperWorld (http://www.greenfoot.org/scenarios/6719) to make a vertical scroller. The documentations says it's possible, but I can't seem to make it work. I tried to set scrollType to 2, but nothing happens. What is the right way to do this? Edit: and something else, I have an actor which is a subclass of SmoothMover, but in the scrolling world it doesn't move smooth anymore. What's up with that?
danpost danpost

2015/1/8

#
You should not be setting the 'scrollType' yourself. It sets itself when the 'super' call is executed in your subclass constructor. If the first and fourth parameters (the 'wide', window width, and the 'scrollWide', scrolling width parameters) are the same value, it will not scroll horizontally and the value of 'scrollType' will be set to either '0' or '2' depending on the values of the second and fifth parameters (the 'high', window height, and the 'scrollHigh', scrolling height parameters). Some, if not all, SmoothMover classes may not be compatible with a scrolling engine. The scrolling engine must be able to adjust the positions of the actors in the world and does not in itself know which actors are treated as smooth moving actors. I think the scrolling engine must be written to work with a specific smooth moving engine to begin with (or the smooth moving engine written for a specific scrolling engine) for them to be compatible. There may be a programmatic work-around to compensate; but, I would not be able to help without access to your scenario; and even then, cannot promise anything.
Ruvero Ruvero

2015/1/8

#
I got the vertical scrolling working, thanks a lot. And I will see if I can find a solution for the SmoothMover, thanks for explaining.
Ruvero Ruvero

2015/1/9

#
I now have another problem with the scrolling engine. getY() returns the Y position of the actor relative to the camera. How do I get the 'actual' Y position of the actor.
danpost danpost

2015/1/9

#
My scrolling engine does not alter what 'getX' and 'getY' return; and if you are using the SmoothMover class that comes with greenfoot, it does not either. So, those methods should be returning world coordinates (as int type values).
Ruvero Ruvero

2015/1/9

#
Found another solution to my problem, thanks though.
You need to login to post a reply.