Commit graph

16 commits

Author SHA1 Message Date
Jay Oster a92adf1b12
Add explicit clippy deny all, and forbid unsafe code (where possible) (#38) 2019-11-06 21:16:25 -08:00
Jay Oster 2d0b053cd7 flat_map 2019-11-03 16:58:58 -08:00
Jay Oster 28f927e153
Switch from rand_core to randomize (#31)
- For #7
2019-11-02 15:29:09 -07:00
Jay Oster 8801bad58a
Update public API to provide &mut [u8] instead of accepting &[u8] from the app (#22)
- Closes #19
2019-10-21 23:17:58 -07:00
Jay Oster 076e4e519e
Implement collision detection (#8)
* Implement collision detection

* Minor cleanups.

* Add laser/player collisions

* Add laser collision with bullets and fix fire button repeating

* Add basic shield collisions

* Refactor collision and debug

* Simplify collision and debug by not tracking laser indices

- We don't care about which laser collided, because they get destroyed immediately.

* Don't track laser indicies against bullets either

* DRY and docs

* Adjust the fleet bounding box as invaders are shot
2019-10-13 19:48:20 -07:00
Jay Oster b6fcf803e7
Invader AI (#6)
* WIP: Invader AI

- Adds debug mode for visualizing bounding boxes
- Adds rectangle and line drawing (for debug mode)
- Invaders move as a close approximation to the original game
- TODO: Demonstrates that the blit function needs to ignore black pixels (or "transparency")
- TODO: The invader movement code is really bad

* clippy and fmt

* Refactor Invader movement

* Support "transparency" in blit function

* Scale player movement to 60 pixels per second, regardless of frame rate.

* Add assertions in blit to prevent drawing out of bounds

* Add bullets, shoot with space

* Add lasers, and improve the bullet animation a little bit

* fmt
2019-10-12 14:26:47 -07:00
Jay Oster 31bc8c7614
Refactor animations (#5)
- `SpriteRef` impls `Animation`, `Sprite` does not
- Animation duration and delta time now lives on the struct that handles the animation "state machine"
- Tweak the player animation to 100ms frame duration (was 50ms)
2019-10-08 19:54:57 -07:00
Jay Oster d0a16f9a71
Add player controls and shields (#4) 2019-10-08 00:35:53 -07:00
Jay Oster d7fc1eca3c
Refactor SpriteCache and animation (#3)
* Refactor SpriteCache and animations

- Animation frames are now enumerated
- Renamed the `Sprites` trait into the more apt `Drawable`
- Moved animation to a default impl on `Drawable`
- Added the Cthulhu invader
- Clarify that `World::step_invaders()` is only needed for handling the invader grid
- Renamed `Cannon` to `Bullet`

* Improve readability of some `SpriteCache` uses.
2019-10-07 20:22:34 -07:00
Jay Oster 2767d47d67 Fix for MSRV 2019-10-07 01:11:20 -07:00
Jay Oster 348533ee9a Add delta time steps and a placeholder for control inputs 2019-10-07 01:00:33 -07:00
Jay Oster 960bfb9b3f clippy 2019-10-07 00:31:49 -07:00
Jay Oster d815bb464b Refactor simple-invaders 2019-10-06 13:53:08 -07:00
Jay Oster 1e5621c820 Refactor the stepper 2019-10-06 03:31:16 -07:00
Jay Oster aa9fdf56bf Enable clippy and tests on the entire workspace 2019-10-06 02:31:29 -07:00
Jay Oster 3b7638a012 Initial simple-invaders WIP
- Currently animates two flavors of invader in their usual formation
- Lots left to do, but this is a good start
2019-10-06 02:24:07 -07:00