DEV Community 👩‍💻👨‍💻


Posted on • Updated on

Rust devlog: Part 3

Hello Readers! Welcome to the third devlog on this series where I code a multiplayer turn-based strategy game! If you haven't read the three previous posts, go check them out! This week, I created a simple and exciting selecting system for my troops. Without further ado, let's get into it. Hope you enjoy!

Troop selecting

In the last devlog, I talk about how I implemented the spawning mechanism in my game. Essentially, placing some troops on the board. This went very well and is now fully functional. However, we still need to be able to select those troops and move them. This is what it looks like after this week:

ss 1

Here the skeleton is not clearly distinguishable, so I'll make sure to change some colors for next time.

ss 2

The code for this was actually quite long, so I'll simply sum it up for you. Essentially, we spawn on every board tile two entities, one for movement interactions and one for attack interactions. These both have their own separate components named MoveInteraction and AttackInteraction. They are always invisible, except when the SelectedCardEntity resource (which is an Option<CardEntity>) contains an entity. When that happens, if they are close enough to that entity, we show them. Pretty simple, right? Well, this took around about 200 lines of code. However, I think the result is definitely worth it.

Meme of the week



In conclusion, this was a very short devlog for this week, and it's a bit late. Normally, I would post on Friday, but I think I'll start doing it on the weekends. I may even only post every other week, since I don't have enough progress to show for after a week.

In addition, the code is now on Github for everyone to see! You can find it at here

Finally, I would like to say thank you if you read this post all the way. This was a short one. Also, since it's currently Hacktober, I would really enjoy getting into open source contributions. If you have a project (ideally Rust) that needs contributions, leave a link in the comments and I'll check it out!

Top comments (0)

Let's Get Wacky

Use any Linode offering to create something unique or silly in the DEV x Linode Hackathon 2022 and win the Wacky Wildcard category

Join the Hackathon <-