Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: blackant on March 11, 2013, 03:29:27 PM

Title: how to adapt a texture from a variable [SOLVED]
Post by: blackant on March 11, 2013, 03:29:27 PM
next step of my training series,

i would like to use a variable stored to make choice of texture

traditionnaly:

if variable == 1, apply texture 1
if variable == 2, apply texture 2
else apply texture 0
etc...
Title: Re: how to adapt a texture from a variable
Post by: kiriri on March 11, 2013, 03:53:32 PM
try jeanfabre's ArrayMaker plugin. It supports arrays of textures. Then you can just use your variable as an index.
Other than that there's only the manual way, with one state that checks the int with some "int compare" actions and then fires a lot of different events accordingly.
A third solution (EDIT : contradicting to what I said before, I know :D) would be to write a dedicated action for this. Something like "Select random string" with textures instead of strings and a public int for the index would probably do nicest.
If you wanna do the third but somehow don't get along with PlayMaker(mind you, it's really not well documented), then just ask and I'll fix you up a version.
I just thought you might want to try such stuff on your own since writing your own actions is a very important step towards using PlayMaker to its full extend :)
Title: Re: how to adapt a texture from a variable
Post by: blackant on March 11, 2013, 04:01:55 PM
thanks for your answer,
yeah i try to find many things by myself but after many hours locked this little things i must ask, i know ...:p

other thing i successed don't need to be asked and with time i can do things that i'm not able to script !
playmaker is very very nice with some trains !

anyway i didn't understand anything about your third solution...lol
maybe my english or maybe more skills in programming...
i'll try to do this with arraymaker at first.

see you soon!
Title: Re: how to adapt a texture from a variable
Post by: Lane on March 11, 2013, 04:10:50 PM
All done.

There are several ways to do it. This is only one.
Title: Re: how to adapt a texture from a variable
Post by: blackant on March 12, 2013, 06:24:13 AM
thanks Lane,  i didn't sse that you shared a package, i'll look it to see if it's different from what i fund.
Title: Re: how to adapt a texture from a variable
Post by: blackant on March 12, 2013, 08:39:44 AM
finally i didn't use any Int var and i made a tutorial using arraymaker

see this post:
http://hutonggames.com/playmakerforum/index.php?topic=3364.0 (http://hutonggames.com/playmakerforum/index.php?topic=3364.0)
Title: Re: how to adapt a texture from a variable
Post by: Lane on March 12, 2013, 08:43:21 AM
Awesome! I'm glad you got what you needed done, and thanks for posting up a tutorial to share your findings.