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

Comments for Scrolling SuperWorld

Return to Scrolling SuperWorld

Entity1037Entity1037

2013/5/14

I figured it out before I saw your comment. Thank you anyway.
Entity1037Entity1037

2013/5/14

I figured it out before I saw your comment. Thank you anyway.
Homicdle_mothHomicdle_moth

2013/5/31

Why does the wombat slide around? is there a way to prevent that from happening?
danpostdanpost

2013/6/1

@Homicdle_moth, the movement could have been coded hundreds of ways; it is just the way I chose to do the movement for it in this case.
RonMexicoRonMexico

2013/6/3

First of all, great scenario - implementing it has been a lot of help with my platforming game. I've got a bit of a problem with creating platforms for my world. I figured the easiest way to add platforms to my world would be by instantiating a 3000x400 world where I'd be able to add a bunch of platform objects all over the workspace, saving the world when I've placed them where I want them. After that, I change the parameters for the world object by instantiating the scrolling world with 400x400 dimensions. Everything runs fine; all platforms that I've added to the world are placed successfully via the prepare() method of the SWorld subclass, but the problem I'm facing is trying to get all of my platforms to be prepared from the far left of the world boundary as opposed to the centre. I've noticed that you've provided a means to spawn the player at the far left of the world and that works fine. I'm just wondering how I'd be able to do the same thing with platforms. I hope this makes sense. Many thanks in advance.
danpostdanpost

2013/6/3

@RonMexico, you could set the main actors location to anywhere and execute 'super.act();' to view that area. Then add the actors you want there and 'Save the World'. Then change the prepare call and method call to 'prepareA' (next 'prepareB', etc.) and after the prepareA call reset the actors location somewhere, repeating the process.
danpostdanpost

2013/6/3

The middle line in the last post should read 'Then change the prepare call and prepare method name to 'prepareA' ...'. (replacing 'method call' with 'method name').
RonMexicoRonMexico

2013/6/4

@danpost - Thank you very much for your help. It turns out calling super.act() solved my problems. :)
SparkySparky

2013/7/26

lol,im your 101st follower
A new version of this scenario was uploaded on Sun Oct 13 21:54:01 UTC 2013 Eliminated a lag producer.
BaenefinBaenefin

2013/10/23

I am trying to implement this into my source. I get an error on line 239. "Incompatible types"
danpostdanpost

2013/10/23

@Baenefin, I do not think that is possible. Either you gave the wrong line number, the error was not in the SWorld class or you edited the class (which I specifically requested not be changed in any way).
BaenefinBaenefin

2013/10/23

Ok the lines may differ, but i Copy your code and have not altered it. That's why I was surprised. It is in private void scrollObjects(). The for loop. for(Object obj : genActors) gives me the Incompatible types. Could that be that there is something wrong with my subclass of SWorld?
danpostdanpost

2013/10/23

It is very possible that the problem resides in your subclass of SWorld. Start a discussion thread and post your code.
A new version of this scenario was uploaded on Mon Oct 28 14:28:38 UTC 2013 Simplified some code and made it easier to use (scrolling objects are now added using scroll area coordinates instead of world coordinates).
danpostdanpost

2013/10/28

Need feedback on latest change. Good/bad? Request that anyone who has used this previously, try this version and reply.
I have addressed you in one of your other posts. I asked you to post the code for the scrolling superworld. Could you please do the same for this one as well? And also could you post it in reply to my comment so that I get a notification? Thank you and sorry for any inconveniences.
danpostdanpost

2014/7/15

@greenfootuserthegreat, both this and the other scrolling scenario are open source. You can click on the big green 'Open in Greenfoot' button, with the green foot over the left side of it, to open or download the scenario. It is located just above and to the right of the scenario window.
@danpost, I have tried that multiple times. But my computer does not support external Greenfoot projects. I'm sorry.
danpostdanpost

2014/7/15

@greenfootuserthegreat, after clicking the 'Open in Greenfoot' button, select the 'Save' option. This will put a copy in your downloads folder. From there you can cut/paste it to your scenarios folder and then open it with the greenfoot application (which will create an unzipped folder of the scenario from which you can get the class codes).
@danpost, the thing is that when I click on the "Open in Greenfoot," it downloads and says that there is no application to open it in. I have been trying many different ways to see if I can make it work, but it is not working.
By the way, your projects are brilliant.
danpostdanpost

2014/7/15

@greenfootuserthegreat, do you not have greenfoot installed on your system? if so, you should have a 'greenfoot/scenarios' folder. Cut/paste the downloaded 'gfar' file into that scenarios folder. Open your greenfoot application. From the menubar, select 'Scenarios/Open...'. Choose the 'gfar' file. That opens it.
@danpost, that's what I do, but it does not accept Greenfoot as an application. Thanks for your time though.
danpostdanpost

2014/7/16

@greenfootuserthegreat, the 'gfar' file is basically a zipped folder. You can unzip it with any standard tool and then view the 'java' files with any text editor.
DillybarDillybar

2014/11/24

Let me start off by saying that I love this code, thank you very much for it. However, I am having some issues with the main actor. When the world loads, I have a main actor and it functions perfectly. However, when I remove the main actor and add a new one (defining it as main actor) it is put back on the starting screen instead of where the old main actor was. I was hoping you would be able to help, thanks.
danpostdanpost

2014/11/24

@Dillybar, please start a discussion thread on this issue, I will be able to respond and post code there more easily. However, it will probably be a couple of hours or so as I am pressed for time atm.
Trex9513Trex9513

2014/12/4

this afro
getreidesgetreides

2015/1/29

Hello Danpost, this is really great stuff, I'm going to use it for a project I've been working on for the last months (see a version of the project in a very early stage on http://www.greenfoot.org/scenarios/12057). Keep up the great work!
EduandErnstEduandErnst

2015/3/12

@danpost is there a known bug with .png files as a scrolling background? Or am I doing something wrong? When I place .png file as background and move the pic gets blended all over but when I replace it with the exact same pic as .jpg it works perfectly..
danpostdanpost

2015/3/12

@EduandErnst, I am not quite sure what you mean. Maybe you can start a discussion thread and link an image of what you trying to describe.
danpostdanpost

2015/3/13

@EduandErnst, after further thought, I have come to believe that what you are experiencing has to do with .png files supporting transparency and .jpg not. Try drawing the .png file onto the background image, after filling the background image with color white if needed, instead of just setting the image as the background image. As the backdrop of your world window, the background image should be completely opaque (you should not be able to see "through" or "beyond" it).
danpostdanpost

2015/3/13

@EduandErnst, when I said 'Try drawing ... " in the last comment, I meant as an experiment to see how it works -- not to change the way the scrolling engine sets the image. To set the image of the scrolling background, you could create a new GreenfootImage the size of the 'png', fill it with white and draw the 'png' onto it before setting it as the scrolling background image.
danpostdanpost

2015/3/13

@EduandErnst, when I said 'Try drawing ... " in the last comment, I meant as an experiment to see how it works -- not to change the way the scrolling engine sets the image. To set the image of the scrolling background, you could create a new GreenfootImage the size of the 'png', fill it with white and draw the 'png' onto it before setting it as the scrolling background image.
danpostdanpost

2015/3/13

@EduandErnst, when I said 'Try drawing ... " in the last comment, I meant as an experiment to see how it works -- not to change the way the scrolling engine sets the image. To set the image of the scrolling background, you could create a new GreenfootImage the size of the 'png', fill it with white and draw the 'png' onto it before setting it as the scrolling background image.
EduandErnstEduandErnst

2015/3/14

Yes it seams like it doesn't work with partially transparent .png files, when I fill it with background color it works fine, well I had to fill it anyways. Thanks for the great help. BTW your scenarios are great.
JackhammerJackhammer

2015/4/24

@ danpost, do you have an email address I can contact you by regarding a project?
noskillznoskillz

2015/11/17

Helly, can i contact you private? its very important
FriendlyKFriendlyK

2016/3/6

Thanks a lot Danpost! This really helps out my little project in school.
AreebRazaAreebRaza

2016/5/21

@danpost so far i have used your Scrolling SuperWorld scenario to make a platformer game and it has been working fine, but when i add the feature of shooting fireballs it shoots from the starting point of my character but in my other scenario without scrolling shooting works perfectly fine here is my shootRight class: import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo) /** * Write a description of class ShootRight here. * * @author (your name) * @version (a version number or a date) */ public class ShootRight extends ShootingManager { private int shootingSpeed = 8; public ShootRight(){ getImage().scale(20,20); } public void act() { // Add your action code here. fly(); killBadGuys(); turn(7); } public void fly(){ setLocation(getX() + shootingSpeed, getY()); } } and here's my shootLeft class: import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo) /** * Write a description of class ShootLeft here. * * @author (your name) * @version (a version number or a date) */ public class ShootLeft extends ShootingManager { /** * Act - do whatever the ShootLeft wants to do. This method is called whenever * the 'Act' or 'Run' button gets pressed in the environment. */ private int shootingSpeed = 8; public ShootLeft(){ getImage().scale(20,20); } public void act() { // Add your action code here. fly(); killBadGuys(); turn(7); } public void fly(){ setLocation(getX() - shootingSpeed, getY()); } } here's the code i used in my player class: public void act(){ shooting(); } public void shooting(){ if(Greenfoot.isKeyDown("s") && shootingCounter <= 0 && direction ==1){ getWorld().addObject(new ShootRight(), getX(), getY()); shootingCounter = 70; } if(Greenfoot.isKeyDown("s") && shootingCounter <= 0 && direction ==-1){ getWorld().addObject(new ShootLeft(), getX(), getY()); shootingCounter = 70; } if(Greenfoot.isKeyDown("d") && shootingCounter <= 0 && direction ==1){ getWorld().addObject(new ElementRight(), getX(), getY()); shootingCounter = 70; } if(Greenfoot.isKeyDown("d") && shootingCounter <= 0 && direction ==-1){ getWorld().addObject(new ElementLeft(), getX(), getY()); shootingCounter = 70; } }
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