DEV Community

David Guida
David Guida

Posted on

4 1

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:

  1. Example 1 shows how to initialize the 2d canvas
  2. in example 2 we see how to render a sprite and react to the window resize event
  3. Example 3 shows how to move a sprite on the screen
  4. Then in example 4, we build on top of the previous one, refactoring and cleaning up the code
  5. Example 5 shows how to handle mouse inputs
  6. 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.

Heroku

Simplify your DevOps and maximize your time.

Since 2007, Heroku has been the go-to platform for developers as it monitors uptime, performance, and infrastructure concerns, allowing you to focus on writing code.

Learn More

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay