Hi!
I am working on a Jump and Run game now. And I want to have moving plattforms.
I already tried something and works , but just the half.
I tried this Code :
?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
public class MovingGround extends Ground
{
/**
* Act - do whatever the MovingGround wants to do. This method is called whenever
* the 'Act' or 'Run' button gets pressed in the environment.
*/
public void act()
{
// Add your action code here.
BewegendePlattform(700, 200);
if(getX() <= minimumX) direction = 1;
if(getX() >= maximumX) direction = -1;
setLocation(getX() + direction, getY());
}
public void BewegendePlattform(int Xa, int Xb)
{
minimumX = Xa;
maximumX = Xb;
direction = 1;
}
}
Now it works like this:
the Plattform is moving towards left and when it reached x = 200
it does not move anymore.
Can you help me to fix it please?
Thanks,
Fifilein
