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

2017/9/1

In upComing Platforms

Venbha Venbha

2017/9/1

#
Now I have a scrolling game which the world is endless... But I want to make platforms come from up to down and I want the screen to move too, But I don't know the code for That. Can Someone help with this?

I will appreciate any help, ;)

Please give a Reply :)
danpost danpost

2017/9/1

#
Put:
public void setLocation(int x, int y) { }
in the platform class and use something similar to:
super.setLocation(getX(), getY()+2);
in the act method. That way scrolling will not move them, but they can still move themselves.
Venbha Venbha

2017/9/2

#
Ok, That helped, but I want the world to add the platforms. If the world is like this(see my scenario Scroller Game But assume its scrolling up to down.) I want it to add platforms above.
danpost danpost

2017/9/2

#
If the platforms are to move WITH the scrolling, then, you do not need to worry about the moving or re-locating of the platforms through the world -- only the recycling of them back to above the top or removing them when below the bottom of the world (you can ignore my last post). The scrolling code will take care of them moving through the world. Add them above the top of the world -- either all of them from the world constructor (or prepare method) if recycling, or one at a time from the act method if removing.
Venbha Venbha

2017/9/2

#
Shoud I add the code to add platforms in the world?
danpost danpost

2017/9/2

#
Venbha wrote...
Shoud I add the code to add platforms in the world?
danpost wrote...
Add them above the top of the world -- either all of them from the world constructor (or prepare method) if recycling, or one at a time from the act method if removing.
Venbha Venbha

2017/9/4

#
*Should
Venbha Venbha

2017/9/4

#
danpost wrote...
Venbha wrote...
Shoud I add the code to add platforms in the world?
danpost wrote...
Add them above the top of the world -- either all of them from the world constructor (or prepare method) if recycling, or one at a time from the act method if removing.
But I cant understand the code!!
You need to login to post a reply.