Hello people,
I have been trying to understand how the global variables work. I found a scenario about a rocket and shooting some asteroids, but I can't get it to work. It says Incompatible types.
The idea is, that when pressing a star it will choose the difficulty of the game, then when pressed on the playbutton it will get the information from the selected star, so it will go to the level with the right difficulty.
I have got a world (menu), a button (ster), and a button (playbutton).
In my world, I have put the following code:
My button has got the following code:
And my button has:
I've got the error Incompatible types in my buttons code at the
I get the error, while it highlights the () ..
I have no idea what is wrong with it, I hope someone can help me with this.
private menu difficulty; public menu choosedifficulty(){ return difficulty; }
private void getdifficulty(){ menu menuWorld=(menu) getWorld(); playbutton difficult=menuWorld.choosedifficulty(); difficult.difficulty("hard"); }
public void difficulty(String difficulty){ //executable code with data }
playbutton difficult=menuWorld.choosedifficulty();