Combat System Berth

So, the snakes are harmless, and there is a lot to be put into the system of predators, but they need to be able to attack, and ya know, the player can fight back. We must now place in the combat system, which i imagine will be a center point for all contact of combat type.

Of course, my next question would be, where do I put it? For now, we will create another spine game object and let it gather the needed info. It will need the player and the spawn_controller. Somehow, I need to find the trigger between the two. And I need to think of how collisions of the main sprites will matter.

For now, we will focus solely on deliberate attack, which means, only the player can kill them.

I am learning that a system can be built to do just the most essential, and it is better to test and build upon from that point forward. Creating the object with the combat manager on their, this becomes an object that needs to be connected to other lists, inventory list so we can check for equipped items, and the active mob list so we can identify a target, if any, and then to do the math. Hence, why this is on its own.

I have found that instantiated objects must find the components in the hierarchy, but these managers can exist from the start and therefore can have other components serialized . This does raise some questions about breakage occurring during testing and otherwise, no doubt someone will break a component by removing a serialized component, and all of sudden, something isn’t working right. SO that would be a good reason to have a constant manager be active in the hierarchy in the scene.

When I was writing the code for the Item_Object, within the “as a weapon” section, I had thought about a variable for range of the weapon. I was thinking of using a bool list that would be in order of a 3×3 range of the player. This would only be for melee weapons. Each value of the list would represent weather or not the player would be able to reach that spot with its weapon. And then depending on the facing of the player, rotate that grid accordingly. Then check for mobs in the ‘danger zone’ . This makes me think about collision as well. Still not sure what we will do as far as collision is considered, but when I had the water tiles be collide-able , the players head would hit the water, preventing his feet from going to the edge of the tile. I think the solution for this is to change the collider to only be at their ‘feet’, or point of perceived contact with the ‘ground’.

If the player is attacking facing downward, he might have more of a reach than attacking north, as he could hit a baddy that was halfway up a unreachable tile, yet his head was in a reachable one.

Jesus, I am not even sure this is a good way of doing this ( using the tile grid at all ). Anything else seems like a lot of work for what we are trying to do atm. But we will have to revisit this in the future when development goes beyond a prototype.

Anyways, for now, since we have no real weapon items, we are just going to do a single attack – since it is barehanded.

In the midst of setting up the combat system, I decide that I want to the see the tiles that are being selected as attack zones, and though I do realize I did something wrong, and fixed it, I am no perplexed as to how I can change the tiles during run time.

Simply setting the tile appears to not work, which is strange. Doing multiple google searches has shown that in the past, this may have been a issue . tilemaps are a fairly new class in Unity, so it is possible I am trying to make it do something it can’t really do, which would be a fine assumption until you see that the tilemap class has a function called settile, which takes an argument of vector and a tilebase, which would contain info to change the tile’s appearance. It is also possible that the way I am going about changing the tile is wrong, and somehow I am losing the reference to the tilemap. I reviewed the tilemap generator I made for the map, and there is no black magic or voodoo happening in their, and it is just making multiple calls to SetTile. The reference in combat manager is no different than that of generate_terrain, as it is just simply a serialized field…. so I am stumped.

The player is successfully attacking though, so I am making head way on the combat manager, but since changing the tiles was something I was going to need to do at some point, I really need to figure this out first, before doing anything else.

After many google searches, it seems as though I am doing something wrong ( of course ), as there are many pros on forums stating “yo, just set the tile, and send that tile via settile, and voila!” .

Leave a Reply

Your email address will not be published. Required fields are marked *