Blazor and 2D game development – part 1: intro
Every now and then I go back to game development. It’s literally what brought me into this world of coding, something like 32 years ago. This time I decided to do some experiments with Blazor and 2D graphics.
I don’t have a precise goal in mind right now, just playing around.
Probably this late-night fever started when I wrote about D&D, Blazor and gRPC services.
For those interested, on GitHub you can find a repository with all the examples I’ll be able to come up with.
For now, I decided to proceed at incremental steps and write small features, one on top of the other. As of today, this is the current list:
- Example 1 shows how to initialize the 2d canvas
- in example 2 we see how to render a sprite and react to the window resize event
- Example 3 shows how to move a sprite on the screen
- Then in example 4, we build on top of the previous one, refactoring and cleaning up the code
- Example 5 shows how to handle mouse inputs
- Example 6 shows how to animate a sprite. I downloaded the spritesheets from here and combined them using a custom tool
I will try to write an article for every example, it will also serve as reminder of my train of thought and how I managed to get the code in that shape.
As I wrote previously, I don’t have a precise goal at the moment. I might end up with something playable, although I tend to change idea quite often on this matter. As many of us, I can get distracted quite easily by new shiny toys. Or simply by life 🙂
The next time we’ll start by initializing the Canvas and rendering some text.