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

2015/3/12

How to tell if another actor is clicked?

NAZZA NAZZA

2015/3/12

#
HI. I'm trying to make a program in which when I press one actor, another actor does a function that i have already programmed. I am familiar with
if (Greenfoot.mouseClicked(this))
but is there another way in which I can use this to identify if I have clicked another actor (e.g. Button)? Thanks in advance.
davmac davmac

2015/3/12

#
Yes; you can pass a reference to any object to see if that object was clicked. But: 'Button' is not an actor. It is a class (specifically, a subclass of Actor). You can't check if a class has been clicked. You can only check if an actor (an object) has been clicked.
NAZZA NAZZA

2015/3/12

#
Thanks for the help.
You need to login to post a reply.