playMaker

Author Topic: Texture Matching  (Read 2132 times)

Rabagast

  • Hero Member
  • *****
  • Posts: 683
    • Homepage
Texture Matching
« on: August 25, 2015, 06:35:32 AM »
Hi!

I have a lot of textures in an Array List. I use Array List Get Random to get one of these Textures to add in on a box. Then it will fall down objects. And I need to get the right image in the right box.

So is it a way to check if two textures matches with each other? If you see on image3. This image will match the image on the box.

I would be very grateful if someone could answer me. And if you don't understand my question, please ask me. :)
Check out our homepage. http://www.walsberg.no
Or my personal game blog for news about my games. http://retro-tetro.walsberg.no

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: Texture Matching
« Reply #1 on: August 25, 2015, 01:56:00 PM »
Hi,
i don't know if there is a way to check if textures matches, but maybe it is easier to compare the array index number
you can save the index number in the Array List Get Random.

so if you have (for example) the elephant as item 0 (=index 0)
compare if  the index number matches the box with the elephant (give the box an int 0 value to compare)

Rabagast

  • Hero Member
  • *****
  • Posts: 683
    • Homepage
Re: Texture Matching
« Reply #2 on: August 25, 2015, 03:09:18 PM »
Hi!

But don't you think the Index will be the same for all the Items? I mean index 0 will be the same for elephant, dinosaur etc. Maybe I'm wrong. How should I compare it?

I have two array lists. One for all the items and one for the 3 current items which I copy from the main array list.

I have a collecting trigger on each of these boxes. And when for example the elephant enter the collecting trigger, it needs to check if it's matching with the image on the box.

I was also thinking to compare the Array Index, but I'm not so sure how I should manage it.
Check out our homepage. http://www.walsberg.no
Or my personal game blog for news about my games. http://retro-tetro.walsberg.no

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: Texture Matching
« Reply #3 on: August 25, 2015, 04:23:51 PM »
Hi,

i made a quick sample so you can check it out

but basically what you need to do is when you use "Array List Get Random"
and also get the Random index (int variable) i the same action

when the action spits out your texture, it will also spit out @ which index number it got the texture from

Rabagast

  • Hero Member
  • *****
  • Posts: 683
    • Homepage
Re: Texture Matching
« Reply #4 on: August 26, 2015, 12:24:24 PM »
Finally I got it to work, so far. Didn't find any bugs yet. I got a problem with mouse click on the objects to change the texture. For example the elephant has for example index 1 and when I use Array List Get Next then it starts on Index 0. And I couldn't just start on Index 1, so this was a little tricky, but I found a way. :)

I used the Index of the Array List Get Random as you said djaydino.
But it was not that easy.

Now my brain needs some rest. :)
Check out our homepage. http://www.walsberg.no
Or my personal game blog for news about my games. http://retro-tetro.walsberg.no