Snake Game in Zig with raylib | No Commentary Coding ASMR
Автор: LEASY
Загружено: 2025-05-18
Просмотров: 972
Welcome back to Leasy! In this episode, we’ll build a complete Snake game in Zig using the raylib library—entirely keyboard‑driven with no talking. You’ll see how to initialize a raylib window, handle keyboard input to move the snake, render the snake and food, update the game state each frame, and detect collisions. This walkthrough covers every line of code with no commentary in a format of a coding asmr youtube video.
🔗 Download Zig: https://ziglang.org/download
🔗 raylib‑Zig Bindings: https://github.com/Not-Nik/raylib-zig
🔗 The code in GitHub: https://github.com/smhcpp/Leasy/tree/...
What You’ll Learn:
Project Setup: How to configure a Zig project to use the raylib‑Zig bindings.
Window Initialization: Creating and setting up a window with raylib’s InitWindow, handling frame rate, and closing resources.
Game Loop Structure: Using Zig’s while loop to run the game until the player quits.
Drawing the Game Elements: Rendering the snake body, food, and background using raylib drawing functions.
Keyboard Input Handling: Capturing arrow key presses to change the snake’s direction.
Snake Movement and Growth: Managing a dynamic list of snake segments, updating positions each frame, and growing when food is eaten.
Food Generation: Randomly placing food on the screen when consumed by the snake.
Collision Detection: Checking for collisions with walls or the snake’s own body to trigger game over.
Chapters:
00:00 Raylib setup
05:05 First window
07:01 Game struct
14:25 Drawing snake and food
19:42 Snake movement
21:00 Enters a Guest
23:15 Frame time
27:46 Key input
31:32 Snake Growth
39:22 Collide checking
47:00 Fix food bug
If you enjoyed this deep dive, smash that 👍, drop a comment with your Zig+raylib game‑dev ideas, and subscribe for more Zig projects! 🚀✨
#Leasy #ZigLang #raylib #SnakeGame #GameDev #ZigTutorial #NoTalkingCoding
Доступные форматы для скачивания:
Скачать видео mp4
-
Информация по загрузке: