Class BulletUtil
java.lang.Object
util.BulletUtil
Utility class for handling bullet interactions in the game. Used in Room.
Provides methods to check collisions between bullets and characters and filter out bullets that should no longer exist.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidfilterAliveBullets(List<Bullet> bullets, List<Character> characters) Filters the given list of bullets, removing bullets that have collided with characters and should no longer exist.static booleanshouldBulletStayAlive(Bullet b, List<Character> characters) Determines whether a bullet should continue existing or be removed based on collisions with characters.
-
Constructor Details
-
BulletUtil
public BulletUtil()
-
-
Method Details
-
shouldBulletStayAlive
Determines whether a bullet should continue existing or be removed based on collisions with characters.- Parameters:
b- the bullet to checkcharacters- the list of characters to check collisions against- Returns:
- true if the bullet should stay alive, false if it hit a character
-
filterAliveBullets
Filters the given list of bullets, removing bullets that have collided with characters and should no longer exist.- Parameters:
bullets- the list of bullets to filtercharacters- the list of characters to check collisions against
-