Hi guys ,
I'm working on a fighting game and there is something I can't do here. Lets start by explaining you what I would like to do.
So there are two fighters in my layout. The important thing is that they are the same object, there is only one type of character here. Fighters have several instance variables, including "Control" to define who controls them (0=Player 1, -1=Computer AI) and "Team" to define who they can attack or not, as I plan to put teamfights.
I divided my code in two main parts, the first is the actions of a Fighter (run, punch, jump, etc...) and the second one is what calls those actions : keyboard inputs if it is a player, and AI guidance if it is a computer playing.
I am stuck in this AI thing and it might be because I'm confused with picking. Lets simply start with trying to make a fighter run against another. It looks like this :
if Fighter | Control = -1 (#If the fighter is played by computer)
-Compare X : if Fighter X greater
than Fighter X : Simulate control "Left"
-Compare X : if Fighter X less
than Fighter X : Simulate control "Right"
I need the AI to choose a fighter that is in a different Team and is the nearest target available. Since all the Fighters are the same object, it goes much more complicated and I'm lost here. Any ideas of how to proceed ?
I hope my explanation is clear enough. I been watching tons of videos and stuff but I can't make it clear.
Thank you guys
Vega