CameronJung / ChopperTankFlak

A simple rock-paper-scissors strategy game
0 stars 0 forks source link

Create Ranged unit class #41

Closed CameronJung closed 1 week ago

CameronJung commented 1 month ago

The behaviour of ranged units should be handled by a class. This class will be a child of the class "Turreted Unit".

CameronJung commented 1 month ago

This could just as easily be a child of the regular unit class. However, I am making a promise to myself that this ranged unit will be the last unit added to the game. As such, there is no need to open the can of worms that would be to refactor the various unit classes into a proper tree.

CameronJung commented 1 month ago

I am going to try rewriting the code that handles how a unit determines what it can do. Ideally I will be splitting up the functions in such a way that they can be called sequentially to build upon each other. Namely, there will be a function to get the hexes that a unit can move to, A method that given which tiles a unit can move to, which tiles it can attack, and a method that determines which tiles can be attacked at range.

CameronJung commented 3 weeks ago

The rewrite previously mentioned has been completed, at least to the extent of currently implemented mechanics. I now need to add the handling for ranged attacks.

CameronJung commented 3 weeks ago

It took a while but I managed to implement the functionality of ranged units. I also fixed a few bugs associated with the rewrite. It will be committed to the artillery update branch soon.