Member-only story
How To Code a Simple Game In Golang And Fyne
This article will explore how to code a character sprite that can walk around on an image background using Golang, the Image package, and the Fyne GUI toolkit

Some time ago, I followed some of the interesting tutorials by Frank’s Laboratory on how to code games in JavaScript. I have decided to code one of his simple games in Golang using the Fyne GUI toolkit for this article instead of JavaScript.
The structure of the code that I present to you here will also be somewhat different from the original by Frank’s Laboratory, given that Golang works differently from JavaScript.
As in his video tutorial, we won’t be building a complete game, though. You’ll be able to move a character around on a background image using the arrow keys on your keyboard. Nevertheless, this could be the start of an actual game.
The Game Assets
Below, you can see the two-game elements used in this project.
We’ll use a Starwars background and a sprite sheet featuring Chewbacca, aka. “Chewie.” The original links to these assets can be found on the YouTube page of the tutorial by Frank’s Laboratory.