Rust devlog: Part 3
ThousandthStar
Posted on October 9, 2022
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:
Here the skeleton is not clearly distinguishable, so I'll make sure to change some colors for next time.
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
Conclusion
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!
Posted on October 9, 2022
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.