Make an Asteroids Clone in Python Using Raylib
In this video tutorial, we're going through the details of going through a basic Asteroids type project using Python and Raylib!
ππGrab the source (on github): https://t.ly/7L9JC
πLinks & References:
- Raylib website: https://www.raylib.com/
- Raylib github: https://github.com/raysan5/raylib
- Raylib API Cheatsheet: https://www.raylib.com/cheatsheet/cheatsheet.html
- JSFXR: https://sfxr.me/
- DrawTexturePro Demo: https://tradam.itch.io/raylib-drawtexturepro-interactive-demo
ππ»Connect with me:
Twitter: https://www.twitter.com/eyuzwa
===---=== Game Plan ===---===
- setup and configure our Python environment
- load up all of our image and texture data
- load up all sound effects
- create an object that the player controls
- handle keyboard input to move the player
and fire a laser shot
- create a meteor object
- this will be independently updated in our game area
- we have 3 different sizes of meteors: large, med, small
- if a laser blast hits a meteor then it will vanish
- if the player or meteor travels off the side of the game area, it will warp to the other side of the game area
- if a laser shot travels off the side of the game area, it will vanish
===---=== Chapters ===---===
0:00:00 - Introduction
0:00:23 - Asteroids Demo
0:00:53 - Setting up the Python Virtual Environment
0:04:21 - Freezing Dependencies to Requirements.txt
0:05:14 - Creating the main.py entry point
0:07:51 - The RayLib Cheatsheet
0:08:36 - Python main.py
0:09:15 - The Game.py Class
0:12:29 - Importing Game to Main.py
0:14:18 - Creating an Entity.py Class
0:15:20 - Importing Entity to Main.py
0:16:16 - Adding the reset()
0:18:15 - Creating an Enum for Textures and Sounds
0:20:17 - Loading the Game Assets
0:24:04 - Unloading the Game Assets
0:25:17 - Rendering the Player with draw_texture_pro
0:29:19 - Keyboard Input
0:30:51 - Calculate the Player's Position and Speed
0:35:00 - Bounds Detection for Player
0:36:57 - Creating the Meteors
0:40:25 - Rendering the Meteors
0:44:40 - Updating the Meteors
0:46:47 - Creating the Laser Shots
0:49:47 - Rendering the Laser Shots
0:50:47 - Updating the Laser Shots
0:52:00 - Filter functions for Shots and Meteors
0:55:10 - Collision Detection Between Shot and Meteor
1:00:06 - Wrapping Up
#raylib #python #gamedev