Commit Graph

117 Commits

Author SHA1 Message Date
f4df2ae33a Rearrange the main menu components & systems
I'm trying to keep things somewhat in order. Plugins, then components,
then systems. Within those, they're roughly ordered by game state.
2025-08-13 15:36:14 -05:00
fc43be0777 Hook up the action selectors to the buttons
All checks were successful
Basic checks / Basic build-and-test supertask (push) Successful in 7m8s
2025-08-13 14:22:00 -05:00
a74b99deb4 Visual button interaction is working, needs act
All checks were successful
Basic checks / Basic build-and-test supertask (push) Successful in 7m22s
2025-08-13 12:59:38 -05:00
2f9401e93f Begin GameOver scene, widget spawner works
I've taken a lot directly from the Bevy UI button example.
(https://bevy.org/examples/ui-user-interface/button/)

I'll make it look better later. For now, it just needs to exist. Onward
to the UI operation system!
2025-08-13 11:58:11 -05:00
54ef257ab4 Make generic UI despawning function 2025-08-13 11:56:35 -05:00
69bef24913 Collect GUI plugins at the top of the module
I want the different "scenes" to be their own plugins for ease of setup
and reading.

The main menu plugin has been renamed to have "Plugin" first. This is so
the lexical sort in the docs places all the plugins next to each other.

The "get-ready" plugin has been given an empty struct and an
`impl Plugin` to match the main menu plugin. I've started the game over
scene, but left it unimplemented.
2025-08-13 11:09:48 -05:00
df4479bf49 Remove collision debug print system 2025-08-13 10:33:59 -05:00
33828d6a85 Rewrite WorldSize as a newtype around Vec2
All checks were successful
Basic checks / Basic build-and-test supertask (push) Successful in 7m7s
Closes #16

Bevy provides Deref and DerefMut derives, so that's nice. I'm not sure
it makes any sense to keep the field private since those derefs expose
the Vec2 anyway. I added an `impl Default` anyway, though.
2025-08-12 23:39:19 -05:00
5e2018d3e4 Docs for physics module 2025-08-12 23:26:37 -05:00
7c877264a2 autoformat 2025-08-12 23:18:46 -05:00
16842c13f7 Docs for objects.rs 2025-08-12 23:18:33 -05:00
e199db16eb Docs for machinery.rs 2025-08-12 23:01:32 -05:00
f17910daef Docs for lib.rs 2025-08-12 22:41:37 -05:00
70f2313766 Improve documentation for the events
Some checks failed
Basic checks / Basic build-and-test supertask (push) Has been cancelled
2025-08-12 11:33:00 -05:00
58bbc1e614 Fix documentation links 2025-08-11 23:50:43 -05:00
79679759c5 Move HUD spawning system into widgets
It actually needs to be completely replaced. When that finally happens,
the new bits will live here.
2025-08-11 23:42:06 -05:00
0e517de419 Move the title screen stuff into widgets.rs 2025-08-11 23:40:52 -05:00
cb2b57449a Create a "widgets" module (by moving title scene)
The non-gameplay scenes are really just a bunch of widgets. I'm going to
put them all together and then bundle the functionality with some
exported plugin builders.
2025-08-11 23:39:42 -05:00
9a262fcffc Move Lifetime component to machinery module 2025-08-11 23:34:12 -05:00
34ee2fcc7d Create a "machinery" module for game systems
I'm not sold on the name, but anyway.

This module will hold the systems that power the main game mechanics, as
well as a few extra items to support that (in particular, the Lifetime
component).
2025-08-11 23:28:39 -05:00
93da225636 Move resources to a resources.rs submodule 2025-08-11 23:19:06 -05:00
cd194e2dbf Move collision system to physics module 2025-08-11 23:07:18 -05:00
1369a3092f Move the ship & bullet systems into the object mod 2025-08-11 23:01:14 -05:00
619037dab0 Move asteroid spawning & splitting systems
They deal with events, but are directly related to how the Asteroid
object interacts with the events, so I'm putting them here.
2025-08-11 22:59:20 -05:00
c1b69c412a autoformat 2025-08-11 22:48:08 -05:00
d8a83b77c2 Move ship & bullet to the objects module 2025-08-11 22:47:48 -05:00
f5ff7c8779 Move Asteroid components to the objects.rs mod 2025-08-11 22:44:05 -05:00
f4484f759f Move SpawnAsteroid event into events.rs 2025-08-11 19:16:34 -05:00
571b910945 Rename "event" module to be plural "events.rs" 2025-08-11 19:14:22 -05:00
804186ea2f Handle player ship destruction... some of it...
Some checks failed
Basic checks / Basic build-and-test supertask (push) Has been cancelled
The player will be respawned, their lives decreased, and the board
cleared. The UI doesn't update, and the sudden snap to a freshly reset
board is quite jarring. The state transition to GameOver stops the game,
but there isn't anything else running in that state so it just looks
frozen.

Basically, there's a ton left to do, but technically I have handled
player ship destruction!
2025-08-10 21:29:25 -05:00
45b1fe751f Create the asteroid splitter to break down rocks.
Some checks failed
Basic checks / Basic build-and-test supertask (push) Has been cancelled
2025-08-10 20:45:08 -05:00
3d28d489b0 Fix: Pass size through to spawned asteroid
I actually have most of the asteroid's destruction handling system done
and found this bug.

Asteroid *assets* are selected based on the size set in the spawn event,
but the `Asteroid` Component itself was left hard-coded to the smallest
size.
2025-08-10 18:46:49 -05:00
cdd665cc93 Add bullet on-impact despawning system 2025-08-10 18:43:56 -05:00
364fbd7530 Use the lifetime limiters on Bullets & Asteroids
All checks were successful
Basic checks / Basic build-and-test supertask (push) Successful in 7m3s
Closes #14

Despawn bullets to limit range.

Despawn asteroids to limit random garbage floating around the scene.
2025-08-10 17:14:26 -05:00
2f463303a0 Create Lifetime component and system
Closes #13

The lifetime component, and system to operate it, are ready! Now I can
delete things that have lived for too long.
2025-08-10 17:07:20 -05:00
8d689d7842 Wire in the bullet & asteroid destruction events 2025-08-10 16:49:22 -05:00
65f28e832f Implement basic gun controller
All checks were successful
Basic checks / Basic build-and-test supertask (push) Successful in 7m3s
The spacebar fires the gun, bullets are spawned on top of the ship with
a velocity that sends them forward (relative to the ship).

I still need a despawn mechanism, and a fire rate control. To despawn
things, I'm already planning a `Lifetime` component. For rate of fire,
an additional component will be created and attached to the player ship.
2025-08-10 13:30:42 -05:00
dea8a0dc1a Fix: apply thrust input properly
All checks were successful
Basic checks / Basic build-and-test supertask (push) Successful in 7m11s
Yay for funny coordinate spaces. I was, again, using the wrong
operations to get the 2D Cartesian angle and apply force to the ship.
2025-08-09 16:25:19 -05:00
6191fde25a Fix: apply steering input properly
The ship in Asteroids isn't expected to spin up while holding a steering
direction, but that's exactly what I just made it do.

Fix that problem by assigning, not accumulating, the angular velocity
for the ship.
2025-08-09 16:09:54 -05:00
d4f11faf5a Fix: integrate rotation *correctly*
Something something quaternions are hard. I thought I would take the two
"things", add them together, and then put them back into the transform.

That's clearly not how it works :v
2025-08-09 16:04:51 -05:00
e841facf73 Remove Rotation component, update usage sites 2025-08-09 16:04:12 -05:00
939ffc70a1 Add AngularVelocity, begin removal of Rotation
The rotation component is also redundant with Bevy's transform
component.

This new component and system fill the physics role, but the input
handling code needs to be updated.

Player steering still functions because it uses the `Rotation` component
to direct the force vector. The force is correctly applied to the linear
velocity vector. An improvement would be to have a force/impulse
accumulator so I could account for mass, but I'm not going to do that
right now.
2025-08-09 15:50:54 -05:00
877c7f93d7 Drop TODO to combine phys fns, update docstring
Replacing the `Position` component with direct manipulation of the
transform functionally completed the TODO. The functions weren't exactly
combined, but the resulting behavior might as well have been.

I've updated the docstring to (exist, actually. yay syntax) describe the
system accurately.
2025-08-09 15:26:28 -05:00
2b1a0f386e Add an angular velocity component 2025-08-09 15:14:05 -05:00
515ecaac27 autoformat 2025-08-09 15:11:57 -05:00
3922cac3d7 Finish removal of Position
The component has been completely removed, and all call sites are fixed
to use the Transform directly.
2025-08-09 15:10:44 -05:00
e834d94b8a Use Transform not Position in wrapping system 2025-08-09 15:08:15 -05:00
ad5e86a06b Begin removal of Position component
The position component is redundant with the built-in Bevy Transform.
I've updated the velocity integrator to use the transform directly.

Physics still works, but things still set their initial locations
through the Position component. I'll need to fix all those call sites.
2025-08-09 15:05:02 -05:00
3d0da6df2d Fix module-level docstring in asteroids & config
I made a comment to help me remember the purpose, but if I do it this
way `cargo doc` will render it out to the actual documentation.
2025-08-09 14:55:07 -05:00
73b97ad15c Re-order use statements, prefer crate mods first 2025-08-09 14:53:50 -05:00