I have a class called Arrow. I have 4 arrows on my screen, each arrow will represent something different when clicked. so my question is, how do I apply code to only one of these instances when that specific one is clicked?
I have a class called Arrow. I have 4 arrows on my screen, each arrow will represent something different when clicked. so my question is, how do I apply code to only one of these instances when that specific one is clicked?
Add a field to the Arrow class and give it a different value for each arrow (when created). Then when clicked, you can do whatever depending on the value of the field.
Or, assign and keep a reference to each one in your world class (which would give each one a different name) as you create them and have the world check for clicks on each one.
Sorry for my late reply. I actually found one of your previous posts and got it to work (in between the time that greenfoot takes to check its not spam) but thank you very much :)
I used getWorld().getObjecta().get() to specify the specific object.