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

2020/10/21

STRING

BastienY BastienY

2020/10/21

#
I want to create a void like public void popup( string , int x, int y){} like when i go in a new room there is a popup with a text. x and y are the position of my text.
RcCookie RcCookie

2020/10/21

#
You can use showText() from the World class. In your world class, simply write:
public void popup(String text, int x, int y) {
    showText(text, x, y);
}
In fact, you can ignore writing your own method for that because that is exactly what showText does.
danpost danpost

2020/10/21

#
RcCookie wrote...
You can use showText() from the World class.
From an Actor subclass with an actor that is in the world, you can use:
getWorld().showText(text, x, y);
You need to login to post a reply.