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

2013/10/22

endless word

RedCreeper RedCreeper

2013/10/22

#
I'm trying to make a game similar to the gba Zelda and I would like to make a world the can slide in any direction given the location of the actor Player please help.
There are several scrolling worlds, look at danpost's Scrolling Super World or Busch2207's ScrollWorld .
RedCreeper RedCreeper

2013/10/23

#
I got danpost's to work but how would I add actor to the outside the viewable area before the game starts?
danpost danpost

2013/10/23

#
You can use 'setLocation' using negative coordinate values after adding it to the world. And if you want the starting screen to still show it, add a 'super.act();' statement immediate after resetting its location.
danpost danpost

2013/10/23

#
Please be advised that my Scrolling Super World is NOT for an endless world. It is for a limited world that is larger than the applet window.
RedCreeper RedCreeper

2013/10/23

#
So would it be like addObject(new Actor(), 25, 25); then in the Actors constructor setLocation(-300,-300);
danpost danpost

2013/10/23

#
RedCreeper wrote...
So would it be like addObject(new Actor(), 25, 25); then in the Actors constructor setLocation(-300,-300);
No. You cannot set the location of an actor in its constructor. The actor is not considered created until the constructor has completed and the actor cannot be placed into the world until the actor has been created. You would follow your 'addObject' line with the 'setLocation' line, one right after the other. But in order to do that, you will need a reference to the actor being created. The following breaks up your 'addObject' line to acquire a reference:
Actor actor = new Actor();
addObject(actor, 25, 25);
actor.setLocation(-300, -300);
super.act(); // calls the scrolling world to scroll
RedCreeper RedCreeper

2013/10/23

#
Also is there a way to,make it so it tilesthe world with a image instead of stretching it
danpost danpost

2013/10/23

#
RedCreeper wrote...
Also is there a way to,make it so it tilesthe world with a image instead of stretching it
Actually, there is a 'fillScrollingBackground' method that will do that for you.
RedCreeper RedCreeper

2013/10/23

#
Thanks
RedCreeper RedCreeper

2013/10/24

#
With the scrolling world, if you were to break it up into a graph how would it be displayed. I mean like if u wanted a building in the top right of the scrolling world,not the viewable world what would be the coordinates. Its a 1,000 x 1,000 px wide scrolling world with a viewable area of 450 x 400
danpost danpost

2013/10/24

#
RedCreeper wrote...
With the scrolling world, if you were to break it up into a graph how would it be displayed. I mean like if u wanted a building in the top right of the scrolling world,not the viewable world what would be the coordinates. Its a 1,000 x 1,000 px wide scrolling world with a viewable area of 450 x 400
If your scrolling area was 1.000 x 1.000, then your main actor would spawn at (500, 500) in scrolling coordinates; which is equivalent to (225, 200) in viewable coordinates. The difference in these coordinates is what you would subtract from scrolling coordinates to get world coordinates Spawning an object at (750, 100) in scrolling coordinates would be placed at (475, -200) in world coordinates.
RedCreeper RedCreeper

2013/10/24

#
So if I wanted something to be at 0,0 on the scrolling world but not the viewable what would the coordinates be
danpost danpost

2013/10/24

#
For any (scrollingX, scrollingY), the world coordinates would be (scrollingX-(1000-450)/2, scrollingY-(1000-400)/2) or (scrollingX-275, scrollingY-300). (0, 0) would then be (-275, -300) in world coordinates.
RedCreeper RedCreeper

2013/10/24

#
Thank you, that makes it so I don't have to check and guess with the location
You need to login to post a reply.