Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
"Switch" loops not working as it should
palistov Offline
Posting Freak

Posts: 1,208
Threads: 67
Joined: Mar 2011
Reputation: 57
#6
RE: "Switch" loops not working as it should

That's not an issue with script; your code is perfectly fine Smile

A lot of people have this misunderstanding about AddEnemyPathNode. A wait time of 0 does not mean the monster waits for 0 seconds. The monster will pause at any node he is assigned, regardless of the duration being 0 or otherwise. If you want him to loop in a circle, you need to clear his nodes then assign him a new one before he reaches his destination. Use collision callbacks for this. If he reaches his destination node, he will pause before executing his next movement, regardless of the wait time. It sucks, but that's how the game is coded Sad

Edit to expand on your circle loop:
A good way to implement a grunt moving in a circle is to make a circle, and assign him every 2nd or third node along the circle. And before he reaches this node, clear his assigned nodes and add the next one in the loop. This way constantly moves the same direction along the circle; if you just repeatedly add the same node he could potentially turn around and go backwards, depending on how your nodes are set up.

(This post was last modified: 02-18-2013, 10:38 PM by palistov.)
02-18-2013, 10:36 PM
Find


Messages In This Thread
RE: "Switch" loops not working as it should - by palistov - 02-18-2013, 10:36 PM



Users browsing this thread: 1 Guest(s)