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

Report as inappropriate.

danpost
danpost presents ...

2012/11/20

Scrolling SuperWorld

An easy-to-use world superclass that implements scrolling actors and background. Fully documented with instruction and code.
When using cell sizes greater than one, all dimensions (world and universal) are rounded up to next odd integer.

jump: up arrow
move: left and right arrows

16833 views / 110 in the last 7 days

33 votes | 0 in the last 7 days

Tags: demo with-source scroll danpost superclass supportclass superworld

This scenario is a member of: Scrolling games, Support Classes by danpost


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

2016/5/21

@AreebRaza, please start a discussion thread on this and use code tags to display the code (see below the 'Post a reply' box for the link 'Posting code? Read this!'). In the meantime I will look over my SWorld class to re-familiarize myself with it. Oh, and usually, lag will occur with larger backgrounds and/or too many objects in the world.
danpostdanpost

2016/5/22

@AreebRaza, after reviewing, I find that all you need to do is change all occurrences of 'getWorld()' to '((SWorld)getWorld())'.
AreebRazaAreebRaza

2016/5/22

@danpost i tried your idea but it still does the same thing, shoot from the starting point of the Actor. but i did find a great scenario at http://www.greenfoot.org/scenarios/13053 and in his SWorld class he just had a little bit of changes than your SWorld, in your SWorld in the you had the methd [code] public int getUnivX(int worldX) { return (scrollingWidth-getWidth())/2+worldX+scrolledX; } [/code] all he did was change it to [code] public int getUnivX(int worldX) { worldX+scrolledX; } [/code] and it worked anyway i appreciate your reply
danpostdanpost

2016/5/22

@AreebRaza, in the 'getUnivX' and 'getUnivY' methods, the amounts returned do appear to be totally screwed up. I must of had a brain-fart the day I wrote them. Maybe I should just have a 'getScrolledX' and 'getScrolledY' methods and let the user determine what to do with the information they return (so the above could be ascertained with 'int x = getX()+getScrolledX();'). Those methods are not used within the SWorld class itself, so changing them wont hurt anything.
A new version of this scenario was uploaded on 2016-05-22 10:07:48 UTC Simplified troublesome methods ('getUnivX' and 'getUnivY' changed to 'getScrolledX' and 'getScrolledY').
A new version of this scenario was uploaded on 2016-05-22 15:13:38 UTC
TanonicTanonic

2016/6/13

Hey I would really appreciate your help, I'm making a jump and run game for school and when walking left and right the blocks I jump on just move with me, how can I make them static?
danpostdanpost

2016/6/13

@Tanonic, you should probably start a new discussion thread on this. Show the code you are using for placing the actors in the world and the movement code of your main actor.
errorfree@123errorfree@123

2018/3/30

this website is related to technical thing i can gather so much od information from here but i have some other issues which is related to QuickBooks billing system it is the very easy way to manage the account in our devices but if you face any problem with this QuickBooks kindly contact to this website https://quickbooksupports.co/
DeleriumzDeleriumz

2018/11/25

is it possible if you could contact me via email dan? to discuss some of ur games imp4ck420@gmail.com thanks

See all comments

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

Who likes this?

matthijs124 Kevroa Super_Hippo AreebRaza MusicalScore Jellyfish etbillder getreides Ruvero Dillybar Heavenly_Father_Banting Mimagic awesomeinmyworld Homicdle_moth asterodia al_griff sametguzelgun JetLennit FlyingRabidUnicornPig dianefayeparajes