- Home /
How to add multiple values to single variable(or something else)?
(english isnt my mother language)
Hi! What I mean with the above question is that I am currently trying to create an RTS game, much like age of empires, with my friends.
And right now, the thing that troubbles me the most is how to set up the pathfinding system. I have tried to look up tutorials and other whatnot, but I have not found any simple tutorial or readable code to learn from. But I have gotten a pretty good idea about what needs too be done in order to create this pathfinding script inside of unity.
I know about angryant and AaronSomethingSomething packages, as well as meny others but I have not been able to learn/find anything usefull about them. Plus, I want this script to me entirely created by me, but ofc with a little bit of your help CunityCommunity!
In the process I figured out how to somewhat script this pathfinder. BUT... I encounter a little problem. That is that I need to be able to Call something like NODE.x, NODE.y, NODE.parent and so on. And I need to be able to use it in some sort of array. something like:
function NODE(x, y, parent, h, c, tc){}
And then call it into an aray..
currentNode = new NODE(x, y, parent, h, c, tc);
OpenList.Add(currentNode);
To later compare it to other Nodes. I am using a simple flat surface. With X & Y And "walls".
Problem is also that im still learning unityscripting and programming in general. So dont give me anything too advanced to work with here.. ;P
TLDR:
How can I Do somehting like this:
function NODE(x,y,parent);
and then:
CurentNode = new NODE(x, y, parent);
TheArray.Add(CurrentNode);
The use is for Pathfinding with the Astar algorithm! Or can it be done in some other way? Links? Videos? Examplescript? Anything will help! Thx!
//Edvin
Your answer
Follow this Question
Related Questions
adding multiple values to single function/variable. 0 Answers
arongranberg A* pathfinding project help 0 Answers
How to apply A* algorithm in C#? 2 Answers
Lost in Pathfinding 1 Answer
Pathfinding and AI for an RTS game 3 Answers