How do I search a particular range of an array?

0 favourites
  • 3 posts
From the Asset Store
Searching
$16 USD
Searching is a game where you are challenged to find all the images with the requested letter in 30 seconds.
  • With arrays there just seems to be 'for each element' as a way of searching through.

    It seems inefficient and awkward that if I had an array with 100 value and I just want to search from 12 to 18, I have to set it to go through the whole thing and set up some way of counting when I'm actually inside the range I want.

    If I wanted to search from position 12 (or whatever number inside the array size) through a bunch of strings in the array until I find "<NP>", is there another way to do this apart from 'for each element'? It's for showing the instructions of the game, with <NP> signifying the end of one page of text.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • I have an alternative that might work for you. Let's take your example and say you want to search from position 12 to 18 until you find <NP>:

    Remember you can right click the image and click 'view image' if it doesn't fit your screen.

  • Thank you, Voulk. I think that will do it!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)