Starting With Raylib
Written on August 27th, 2020 by Rangga GunartoThe Start Of Something Great?
So, i was planning to make tetris with cpp and instead of using game engines such as Unreal Engine, Unity or Godot i decided to use a library instead. More details about raylib can be found on their website https://raylib.com/ Once i finished building the library and hopped on Visual Studio Community, at first i was sligtly overwhelmed by the amount of functions and other things on their cheat sheet but i eventually narrowed down what i needed.
Getting Settled Down
I first opened a basic window file from their examples folder and started messing around with a couple of functions, after that i settled down and set up to get started. At first, i was thinking too much about how i would do it in a game engine but then i realised i was using a library so essentially i had to re-start my thoughts and notes over.
Covering Basic Aesthetics And ‘Spawning’ Blocks
Then, i settled for grid based movement with arrays being the essential play grid. I first had to show the blocks, i did this by putting ‘x’ on the grid and if there was an ‘x’ on the grid it would draw a rectangle. Next, i worked on the movement which would move the ‘x’ on the grid down by one row. I did this by making for loops, the for loops would check where the positions of the ‘x’ character was in the array and move them down. I did this by making a variable that would essentially move it down ever 0.5 seconds. (note: i was using 2D arrays). It was all working great but then i realised… there was no hit detection. Well thats it for today and here’s the current changelog.
Changelog:
- Added movement
- Added drawing the blocks
- Making the grid
- Drew the play grid and other misc aesthetics