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

2012/10/31

How to move the World

AzonnerA AzonnerA

2012/10/31

#
I want to make a game that can move the world. there may be able to help me.
darkmist255 darkmist255

2012/10/31

#
If you mean a game like a side-scroller or an eagle-eye view game, this is 100% possible. Say you have a side-scroller game; One easy way would be to make all of the "movable" actors move left/right with the button presses and have the player stay in the middle of the screen. A more versatile way of doing it would be to have a variable in the world called "xScroll". Have a variable for each of your actors called "xCoordinate". Then, in the act cycle for each actor, make them do "setLocation(xCoordinate + world.xScroll, getY());". Hope that helps. ALSO Make sure that when you call the superclass for your world you add in a 4th parameter "false". For example "super(800, 600, 1, false);" This disables the "blocking" that prevents actors from leaving the screen. You would need them to leave if they scroll off.
You need to login to post a reply.