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

Report as inappropriate.

Gevater_Tod4711 presents ...


Infinite Scrolling World

In this demo of a scrolling super world you have a infinite scrolling system which means that your actor will is able to move in a direction as long as you want.

Examples and discriptions how to use the scrolling system are included in the classes.

Also there are some supotring methods that may help you.

I hope this demo can help you creating a scrolling game.

If you got suggestions for improvements or if you find bugs in the scenario please tell me so I can improve it.

12193 views / 78 in the last 7 days

6 votes | 0 in the last 7 days

Tags: demo with-source scrolling

open in greenfoot
Your browser does not support the canvas tag.


@Gevater_tod how could i remove the blck squares with thee red letters
They are just used to visualize some things. You can delete them in the act method of the class ExampleWorld. If you delete the whole run method and change the super call in the constructor to this: super(800, 450, 1, 2000, 2000, MultiScrollingWorld.CENTRAL_ACTOR_SCROLLING_SYSTEM, false); it should work.




Just a lat question How could i diable all systems eycept for the actor in the middle System
The scrolling system usually stays the same untill you change it. In the demo I uploaded the scrolling system is changed by clicking on the worlds background. If you delete the code that causes this (in the run method of the class ExampleWorld) the scrolling system will not change until you change it manually or by moving to the side of the world.


i copied and pasted all the coding but on the first line of the coding where it says gettotalxmovement down the bottom it says it cannot find the symbol.


I found a bug, if I keep on scrolling for a long time it eventually slows down the movement


@AreebRaza: There are some loops in the createTextur() method of the ScrollingWorld class that might take a long time to complete when the player is very far afield. Here's a version without the loops that uses mod math to do the same job. /** * Creates a moving textur on the background image of the world. */ protected final void createTextur() { // Higher performance version: int x = totalXMovement; x %= textur.getWidth(); if ( x > 0 ) x -= textur.getWidth(); int y = totalYMovement; y %= textur.getHeight(); if ( y > 0 ) y -= textur.getHeight(); getBackground().clear(); for (int i = x; i < getWidth(); i += textur.getWidth()) { for (int j = y; j < getHeight(); j += textur.getHeight()) { getBackground().drawImage(textur, i, j); } } }


How can I download the scenario?


Alright, say I wanted to use this to generate a world as people enter the different areas but keep track of where everything was... How would I do that?

See all comments

Want to leave a comment? You must first log in.

Who likes this?

Alola_Sandslash Kartoffelbrot FlyingRabidUnicornPig Rudi zafae007 Hawx_