Hi !
We want to code a tetris with my sister for fun, but we are a little bit stuck on a point. To make the transition between the piece that has been placed and the next piece, I wrote a little function in MyWorld, with a boolean variable "transition", true when the transition needs to be done and false otherwise. And I want to call my function, nextPiece() in my actor shape. (Since I check the collision between the bottom and my shape, if they are colliding then the piece is placed and the transition needs to be done.) But when I try to call it like "this.getWorld().nextPiece()", Greenfoot doesn't agree haha, and I am not sure how to do it in another way.
Here's my colliding function in the shape Actor, and my nextPiece() function, in MyWorld.
(Sorry if I did any grammar mistakes, english isn't my mother langage).
if(!(getIntersectingObjects(BottomWall.class).isEmpty())){
placed = true;
this.getWorld().nextPlay();
return true;
}public void nextPlay(){
transition = true;
}//Adds new shape if needed
if(transition){
addObject(setNextShape(), (this.getWidth() - leftWall.getImage().getWidth() - rightWall.getImage().getWidth())/2, 0);
transition = false;
}
