How to recycle through images

I have a table with images that are changed with a button and once it go's through all of them, it turns to a white box. How do I get that actor to just continue to loop those table images until one is chosen?. Everything is set up the way I need it's just the looping part I'm really needing help on.

Best Answer

Answers

  • jonmulcahyjonmulcahy Member, Sous Chef Posts: 10,408

    how are you tying the images to the table values? are you looping through a table of names?

    could you go into your actual code a little more? I think i know what you need to do, but I need to know what your doing now to make sure it fits.

  • TRowe007TRowe007 Member Posts: 71
    edited March 2015

    @jonmulcahy said:
    how are you tying the images to the table values? are you looping through a table of names?

    could you go into your actual code a little more? I think i know what you need to do, but I need to know what your doing now to make sure it fits.

    Yes, I have a table with image names of the different characters that can be used and as I scroll through to chose one once it reaches the end of the 5 images it go white. I Have a button that controls this by just going from one image to the next. There a game Att "index" (what image) and inside, changes Att, (whatimage) to (whatimage+1)

  • TRowe007TRowe007 Member Posts: 71

    @jonmulcahy said:
    so do this instead

    change attribute whatimage to (mod(whatimage+1,5)+1)

    the mod is the modulus(sp?) function, which, basically, will loop though however many numbers you input. (it actually does something more complicated about returning the remainder of how many times X can go into a number)

    but basically, this will cycle what image through 0,1,2,3 and 4. The +1 at the end will increase that to 1,2,3,4,5, which is what you want.

    Thanks bro that worked perfectly the only thing I had to start with (mod (whatimage+0,6)+1) instead of +1

Sign In or Register to comment.