x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

How do I go through an array in index order?

So i'm trying to make a one-button game by drawing a path with the mouse and when released the character is going to walk that same path. I'm kinda managing by saving the location of the mouse when the left mouse button is pressed every 0.2 seconds in an array. Then when left mouse button is released I would like the character to walk that drawn path in index order. I manage somewhat by doing every single index, but since that would in the end create way too many similar nodes with just adding +1 to index, I'm wondering if there is anyway to make some sort of loop that walks to index 0, then index 1, index 3 etc. In order and also not at the same time, so the character actually makes way towards index 0, then index 1 and so on.

Any ideas?

Thanks

Product Version: Not Selected
Tags:
more ▼

asked Dec 15 '14 at 01:12 PM in Blueprint Scripting

avatar image

kallepewpew
5 2 4 4

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

3 answers: sort voted first

ForEachLoop. Then put a delay in the loop to cover how long it takes to walk from one point to the next.

more ▼

answered Dec 15 '14 at 01:56 PM

avatar image

Zeustiak
1.8k 131 68 110

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

Did you already look at behavior trees?

It might be a bit overkill but they allow you very easily exactly what you need.

The tree will do tasks one after another. You can create a talk which selects the next point in your array and put a move to node right after.

It will select the point, walk there (if possible) and then execute the next task (again the point selection).

As I said a while behavior tree for something like this might be a bit overkill but it is quite a valid option.

more ▼

answered Dec 15 '14 at 03:03 PM

avatar image

Erasio
5.9k 291 86 293

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

Sorry for such a late answer, but thank you all! With the help of a foreachloop I got it working :)

more ▼

answered Jan 10 '15 at 10:28 PM

avatar image

kallepewpew
5 2 4 4

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question