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

2020/10/29

my platforms are acting funny

1
2
danpost danpost

2020/11/3

#
MrSkyPanda wrote...
do you think you could share a simple example?
The getY method gets the y-coordinate of an actor in the world.
int y = getY(); // for instance of enclosing class
// or equivalently
int y = this.getY();
For an instance of a actor of a different class, like a platform in the world assigned to a variable called ground, use:
int groundY = ground.getY();
You will not need the former y-value -- only the latter one.
MrSkyPanda MrSkyPanda

2020/11/4

#
do i put this in the lines that you mentioned earlier?
danpost danpost

2020/11/4

#
MrSkyPanda wrote...
do i put this in the lines that you mentioned earlier?
That would be for step (3); however, you will need to do step (1), which assigns the intersecting platform to the variable ground, for it (step 3) to work. The other steps would still need to be completed, as well, for the behavior to be righted.
You need to login to post a reply.
1
2