What we get from this is that the soul's collision box isn't moving properly with its image (JLabel). However, as you can see from the overlapping red and purple, the projectiles themselves have matching images and collision boxes (the image just happens to be slightly bigger than the collision box, due to empty space at the bottom of the image). I find this very strange, as Projectile and Soul are classes that both extend another class, CollisionLabel, which handles everything to do with movement and collision boxes. If one works, so should the other, but that's not the case. I'll continue working on this issue and make a new post when I run into a new problem and/or fix this one.
Edit: The error was really simple, actually. Soul's move method calls CollisionLabel's setLocation method, which doesn't work, while Projectile's move method calls CollisionLabel's moveLocation method, which does work. For now, I've implemented a simple work around by calling CollisionLabel's moveLocation method in Soul's move method. This does cause some issues, however, when trying to set a Soul object's location. I will work on fixing the setLocation method.
No comments:
Post a Comment