Posted September 18, 2022 by FernKing
#Unity 2D #Chess #Pixel Art #Devlog
Basic Player Movement Devlog
The focus of this week was basic character movement. However, my game doesn’t really have a single ‘player’ nor is the movement that basic to implement. Subsequently, I’ve decided to postpone the pain of tackling this task till next week.
This week’s NEW focus is random bits and bobs. The new agenda looked something like this…
Implementing the logic for a chess like game seems like an incredibly daunting task to approach for someone such as myself. After trying to consult some youtube videos for comfort, the difficulty was made even more apparent.
In this series, chess is fully implemented through code/scripts in unity. 9 episodes later, many a tear and visits to Scripting API and blam you got chess. I didn’t really want to sign up for this especially for a 7 week project.
I began looking for an easier solution. Putting full reliance on code seemed somewhat where the difficulty lies. I figured some corners could be cut by utilising some of the systems unity has in place. This includes the raycasting, collision and find systems. I decided that a good foundation for simple coding could be built off using GameObjects to handle Co-ordinates. Co-ordinates of every square could be handled by an invisible GameObject with a collider. This serves multiple benefits.
Time will tell if this method will actually be easier but we're off to a good start.
As showcased above, the RayCast can be used to analyse objects upon a click. The RayCast was made to return an array of collisions therefore it can analyse multiple GameObjects occupying a single space. As seen below, both the unit and the square it is occupying is returned.
The role of the action UI is to manage the triggering of the Move, Ability Phases and the Unit information analysis. I was able to fully implement a system which instantiates the UI as a child of a correct selected target and moves it to the location of that target. This means that when an action is selected the target can be found as the parent of the object.
The implementation of all this has laid the framework for the movement phase to be tackled next week. See ya there 😊