A compilation of examples on how to use the Go bindings for Raylib (https://github.com/gen2brain/raylib-go).
This is intended as a resource to help beginners learn some basic Raylib and Go game development skills. If you want to use any of the code anywhere else, feel free to do so. As there are fairly few resources related to making games with Go/Golang this is intended to help people who may be interested in learning Go for making games or for people that already know how to code in Go and want to make games for fun or want to implement more advanced graphics in applications. Note that Raylib can also be used to create UI (user interfaces), data visualizations and other things and is not strictly limited to making games, Raylib serves to make working with OpenGL with Go much easier. There is no GUI (Graphical User Interface) for Raylib and this means that you do need to be able to understand and code in Go to make games using Raylib.
If you need help and don't know already the Raylib Cheatsheet is useful and a good resource for finding information on Raylib functions and (generally) the same function is available in Go, just add rl. in the beginning (prefix).
I am a self-taught Go programmer and do it as a hobby, the code here is my own interpretation of how to do something, probably not the only way or the best way. If you have any suggestions or spot any errors then please let me know.
2D BEGINNER
- Random Color Grid - Random color blocks background
- Moving Space Background - Shooting stars/space background
- Text Center & Scroll - Text resize, center & scroll left/right/up
- Vector2 Collisions - Collisions of rectangle versus border rectangle using Vector2 points
- Room Tiles - Creates randomly sized room and draws tile textures for the walls and floor
- Pixel Noise - Simulates pixel noise / screen artifacts with color & size change
- Animated Character - Simple animated sprite character with speed, color & zoom change
- Exploding Blocks - Create the effect of blocks exploding using slices of structs
- Rectangle Collisions - Checks for collisions between moving rectangles & borders
2D INTERMEDIATE
- Moving Triangles - Illustrates moving polygon triangles with direction change
- Orbiting - Three circles orbiting center point with direction change
- Snow - Draws falling snowflakes using textures with color change & blur effect
- Candlelight - Create the illusion of candelight
- Motion Blur - Create the illusion of motion blur
- Move to Point - Demonstrates moving to point determined by a mouse click on screen
- Move to Point Collisions - Demonstrates moving to point determined by a mouse click with collisions
- Player Bullets - Demonstrates bullets determined by mouse click on screen with camera & player movement
- Chain Lightning - Demonstrates simple chain lightning effect, drawing lines between enemy centers on hit
- Animated Logo - Demonstrates side scrolling Go logo & animated Raylib logo
- Simple Dungeon Map - Demonstrates creation of a simple top-down dungeon map
2D ADVANCED
- Tile Editor - Tile sheet loading & grid drawing
- Moving Spike Block - Creates a moving block with spikes inside a room with player collisions
- Menus & Windows - Demonstrates simple top/bottom, left/right, pop-up and center menu/windows
- Tiled Dungeon Map with Player - Creates random dungeon with image tiles & moving player