I want that if my injection hits a sick Man (Man with image 2) the Man is healed (back to image1). But if I touch him sometimes nothing happens and sometimes if I'm lucky it works. Why does it not react when I'm touching it? It doesn't work with the isTouching() method either. Maybe I have to touch him with a special spot of my object? The code is in class MAN.
Ich will das ein kranker Mann (mit dem image2) wieder gesund wird (zurück zu image1), wenn dieser von einer Spritze berührt wird. Ich hab das mit canSee() und mit isTouching() versucht, aber bei beiden ist es eine Glückssache, ob es klappt oder nicht. Ich kann förmlich im Mann drinnen stehen mit meiner Spritze und es tut sich trotzdem nichts und manchmal berühr ich es nicht mal wirklich und es klappt aber plötzlich. Ich hab gedacht ich müsse ihn mit einer bestimmten Stelle meines Objekt treffen... vielleicht dem Mittelpunkt. Aber es klappt ja nicht mal wenn ich wirklich in ihm stehe....
1 2 3 4 5 6 7 | public void changeImage() { if (canSee(injection. class ) && getImage() == image2) { setImage(image1); } } |