Closed alex-eg closed 7 years ago
@@ master #45 diff @@
==========================================
Files 38 38
Lines 1711 1998 +287
Methods 0 0
Messages 0 0
Branches 0 0
==========================================
+ Hits 955 1120 +165
- Misses 756 878 +122
Partials 0 0
Powered by Codecov. Last update 20fe819...2bf8acb
Closes issue(s): [ #19 ]
Description of the changes: add collision module and tests
Collision module consists from 2 classes: CollisionManager and Collider. There's also one ancillary class: TypePair.
To enjoy the might of collision detection and processing system, you must first create the CollisionManager instance, and then create some Colliders and install handlers for them for each other types. Handlers are commutative, i.e. if you installed handler for collider of "ship" type to handle "rocket" type collisions, it means that you don't have to install collider with "ship" to each new rocket object yoy have created.
add colliders for GenericXEnemy and Playership
Just two colliders, preliminary step to add sample collision processing to InGame state. We can't check for collision with bullets yet, due to some circumstances, but we can do it for two ships.
add CollisionManager instance to InGameState
We add CollisionManager and then add second enemy on the y-level of player ship, to be able to collide with it.
As for now, for some reason, it's impossible, since player controlled ship just wraps to the left of the field. When we have it fixed, collision processing should automatically start working.
Reviewers: [ @pkulev ]
Task list: