I've added a new `event` module to contain all the game's events (which
it does not. I'll collect them all later).
Using these events, the CollisionEvent listening system can watch for
any two colliders intersecting, check on what role they play (asteroid,
ship, bullet, etc), and re-emit an event for that specific thing. Each
component can then handle it's own destruction process.
Rapier expects to have a RigidBody attached to the entity, but I do not.
I'm not going to make one, either, because the objects in a game of
Asteroids don't need collision handling the way most games do. I just
need to know if two objects have started overlapping.
According to this: https://rapier.rs/docs/user_guides/bevy_plugin/colliders#collision-groups-and-solver-groups
only one of the two objects involved needs to have the ActiveEvents and
ActiveCollisionTypes components attached, so I've placed them on the
player ship.
I'm going to grab the Rapier physics library so that I don't have to do
my own collision detection mechanism. The last time I did this, I
simplified everything into circles. This time I'd like to have convex
hulls, particularly for the player ship.
Also the last time, I ended up rolling my own quadtree impl. I'm not
particularly interested in doing that again, and I'd like to learn more
of the broader Bevy ecosystem.
The events are being emitted by the spawn manager, and consumed by the
spawn_asteroid system. Now to wire in the spawn properties, and then
make a good spawning manager.
I'm finally getting around to centralizing all the assets instead of
letting spawners load their own.
I'm missing some assets, which may eventually be filled by textures
instead of solid-colors and simple shapes
I also need to hook up all the functions to use this thing instead.
Not everything needs to wrap, so I'll use a marker component for the
ones that do. At the moment, I'm thinking only the player's ship will
wrap around. Asteroids can be de-spawned and re-spawned, and bullets can
simply evaporate.
The egui debug inspector disappears when switching scenes, which seems
to be related to the camera change. I'm not going to dig into why
exactly this is happening. I'll just create one camera and keep it.
The WorldSize is a Resource so that I can use it in the entity wrapping
system. The size is pulled from a public constant in the config.rs file,
and the window is made that same size.
The ship, such as it is, exists and moves when the player presses "W".
Position is updated according to velocity, and the mesh transform is
updated to match the position.