Targeting, now actually working.

No post last Friday since I didn’t manage to finish the lock-on system.

What i needed to do was searching through the list of targets until i found the current locked target, then find the next non-enemy target in the list and set it to become the current target by looping through the rest of the array of targets. The problem was the fact that the first target might not be the first target in the list which meant that if the loop reached the end of the array without finding a valid target, it needed to go into another loop in order to go through the bottom of the list.

Last Friday i worked on this but never managed to make it work properly, as it turned out i used the un-casted target to determine if the node being searched was the same node as the current target. This lead to some wrong behavior where it would always pick the last node in the list. Thinking about the problem over the weekend made me realize that my theory was correct but that i should use the target’s index number in the array to identify and compare it. Anyways i ended up ripping up the old code and making new rather than replace individual parts. The lines for a bit messy but everything works.

Target pasta

Next up is the system for registering the stick inputs for spells and comparing them to the spells known to the player in order to cast them.

This entry was posted in Uncategorized and tagged , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s