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

Report as inappropriate.

Gevater_Tod4711
Gevater_Tod4711 presents ...

2013/5/6

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.

23895 views / 79 in the last 7 days

7 votes | 0 in the last 7 days

Tags: demo with-source scrolling

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

2014/1/11

Thx
sanoysanoy

2014/1/11

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.
lhtait2608lhtait2608

2015/10/9

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.
AreebRazaAreebRaza

2016/5/18

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

2017/2/17

@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); } } }
LMTLMT

2018/3/28

How can I download the scenario?
XolkiyrXolkiyr

2018/4/25

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?
XolkiyrXolkiyr

2018/6/19

What I mean is, how when the player dies they go back to the original 0,0 and move everything in the same amounts.
danpostdanpost

2018/6/19

@Xolkiyr, you may want to start a discussion on that.

See all comments

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

Who likes this?

yedefei Alola_Sandslash Kartoffelbrot FlyingRabidUnicornPig Rudi zafae007 Hawx_