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

2018/2/28

Touching actors with mouse

Chepaci Chepaci

2018/2/28

#
Hello, guys i need a code for touching an actor ok the scroll is on it i wanna see her name in left corner.
danpost danpost

2018/2/28

#
Please elaborate. Be detailed and precise.
Agent40 Agent40

2018/2/28

#
I think what he's trying to say is, He wants a few lines of code that will allow him to hover over an actor so that it displays the name of the character at a set location.
Vercility Vercility

2018/2/28

#
Agent40 wrote...
I think what he's trying to say is, He wants a few lines of code that will allow him to hover over an actor so that it displays the name of the character at a set location.
yeah but how the hell are we supposed to do that when we have no code? We dont even know the actors name
danpost danpost

2018/2/28

#
You could put something like this in your World subclass act method:
if (Greenfoot.mouseMoved(null))
{
    Actor actor = Greenfoot.getMouseInfo().getActor();
    if (actor == null) showText("", 80, 20); else showText(actor.toString(), 80, 20);
}
You need to login to post a reply.