playMaker

Author Topic: Images from int, string or array list  (Read 2582 times)

4arrancho

  • Playmaker Newbie
  • *
  • Posts: 27
Images from int, string or array list
« on: December 02, 2014, 06:19:07 PM »
Hello,

I have a array list with 100+ numbers. Then i pick randomly 5 of those numbers.

Now i want to show in the scene 5 images according to those numbers that were randomly chosen.

So if goes out number 2, 33, 67, 89 and 140
 i want images nÂș 2, 33, 67, 89 and 140 to show

How can i achieve this??

Thanks

escpodgames

  • Hero Member
  • *****
  • Posts: 687
    • Assets
Re: Images from int, string or array list
« Reply #1 on: December 02, 2014, 07:02:50 PM »
You could have a second array with the textures (leave 0 empty) so the textures match up when you use the array list get action to get the textures.

4arrancho

  • Playmaker Newbie
  • *
  • Posts: 27
Re: Images from int, string or array list
« Reply #2 on: December 02, 2014, 07:10:48 PM »
Can you tell me the action to insert the images to the new array list?

For my list of numbers i used "Split Text To Array List" action with a list with the numbers created in monodevelop

1
2
3
4
5, etc...

What about the images? I don't know these array list actions...sorry

Thanks for help

escpodgames

  • Hero Member
  • *****
  • Posts: 687
    • Assets
Re: Images from int, string or array list
« Reply #3 on: December 02, 2014, 08:46:36 PM »
You would add them manually to the array list proxy via dragging your textures one by one .. tedious I know

OR you could store your textures in the resource folder and load the ones you want based on the name ie

5 = Texturename_5
« Last Edit: December 02, 2014, 08:50:09 PM by LampRabbit »

4arrancho

  • Playmaker Newbie
  • *
  • Posts: 27
Re: Images from int, string or array list
« Reply #4 on: December 03, 2014, 09:55:46 AM »
Thanks for answer

Is this the only way?

Anyone else?

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Images from int, string or array list
« Reply #5 on: December 05, 2014, 01:02:29 AM »
Hi,

 Not really, you can find variants, but the principle will be identical.

-- you can use a proper database to host reference and pointers to your textures
-- you can use XmlMaker can create a description of all your textures
- ArrayMaker will be the most direct and easy way to integrate this using a simple text file that you parse automatically ( check out the word search example )

typically, I would also strongly advice you use "Resources" and adopt a convention that you must have all your texture following a specific name formating, build that name in playmaker "myTexture_{0}" and replace 0 with your random number, and load that texture from the resources, that's the most direct AND efficient, because you will only load in memory the one you need, not the 100th texture all the time.

Bye,

 Jean