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

2012/10/29

Trying to build a Dead Space Game

KevinMR97 KevinMR97

2012/10/29

#
I have a main gist of all the codes i need to put in but if someone could help me with the scrolling world thatd be great if youve ever played games on for say the nintendo 64 games in which the character walks in and the world follows and what not. if someone could help me create a world where the background can move along with the actor throughout the level thanks..
Gevater_Tod4711 Gevater_Tod4711

2012/10/29

#
Of course we can help you with the game but you should ask a question. We can't write the code for you. But if you ask a spesific question we'll try to answer it.
KevinMR97 KevinMR97

2012/10/31

#
i dont know how to get a map to scroll with the character as he moves vertical and horizontal i get the rest but thats the hardest for me
Gevater_Tod4711 Gevater_Tod4711

2012/10/31

#
You could use the scrolling world by SPower or you could redraw the world every time the charactor moves. To do this you need to have two variables for the x and y movement of your character and if your character moves up you have to change the value of the x variable, so that the backgroundimage moves down because this way it looks like your character would move up. Then you have to redraw the world like this:
private GreenfootImage backgroundImage = new GreenfootImage("file");//the backgroundimage you want to use;

public void act() {
    getBackground().setColor(Color.white);//or any other color;
    getBackground().fill();
    getBackground().drawImage(backgroundImage, x, y);//redraws the backgroundimage on the new coordinates. So it looks like the background is moving;
}
MatheMagician MatheMagician

2012/10/31

#
Basically, here are the parts of a scrolling game: 1. You need to draw the background image in different places like Gevater_Tod has stated 2. You need to have all objects except the central character move backwards when you move forward and vice versa. Any of these scenarios do a good job of demonstrating scrolling.
KevinMR97 KevinMR97

2012/11/2

#
Okay i will try this.
You need to login to post a reply.