Writing a simple game in Rust
summary
Builds a fully playable Snake using Rust and the ggez game library, compiled with cargo, with a 20x20 pixel grid mapped to a 400x400 window and an FPS cap of 8. Implements ggez’s EventHandler with update/draw, keyboard input via key_down translating to directions (using Option and if let), RNG fruit placement via rand RNG, collision detection and reset, and a clone workaround for the borrow checker. Uses ggez and pix 20, screen 400x400 to produce a working game.
AI-written summary · about
chapters (25)
- 0:00Introduction
- 0:40Disclaimer
- 5:18Cargo
- 11:05Domain
- 14:19Implementing the game
- 18:17Refactoring the game
- 23:20Looking into the GG
- 23:45Copy and Paste
- 24:04Acceleration
- 25:54Check update time
- 26:12Check number of frames
- 26:55Control the snake
- 27:46IfLet
- 28:41Window Bounce
- 29:05Clever Implementation
- 29:30Dub Implementation
- 30:14Body Implementation
- 31:55Snake Implementation
- 32:17Snake Collision
- 33:06Cargo Run
- 33:34Regenerate
- 35:21Game Over
- 35:35Snake Reset
- 36:36Snake Run
- 38:05Bug fix








