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

2021/3/17

calling a method

Jemy Jemy

2021/3/17

#
is it possible to call a method in Actor in a World Method? if it's, please help
danpost danpost

2021/3/17

#
Jemy wrote...
is it possible to call a method in Actor in a World Method? if it's, please help
Yes -- but it must be a public method and it must be executed on an Actor of type where the method is located.
Jemy Jemy

2021/3/17

#
Please can you show me what you mean?
danpost danpost

2021/3/17

#
Jemy wrote...
Please can you show me what you mean?
As an example:
Actor actor = new SomeActor();
actor.setImage("beeper.png");
Note the line 2 calls the Actor class method, setImage(String), on an Actor type object, actor.
You need to login to post a reply.