Hey y'all. I am having a lot of trouble making an actor appear only when my main actor is touching an interactable object. I will leave u the code I think is relevant here together with the try I have made in order to make this work. Some help would be greatly appreciated.
This code right here is inside my main actor class, "Lucas":
This code is for spawning the Actor at the bottom left of the screen:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | public void touching_interactable_object() { Actor z = new Interact_Button(); spawn_Interact_Button(z); if (isTouching(interactable_objects. class )) { z.getImage().setTransparency( 100 ); } else { z.getImage().setTransparency( 0 ); } } |
1 2 3 4 | public void spawn_Interact_Button(Actor z) { getWorld().addObject(z, 30 , 450 ); } |