How to use the arrows to switch between clothes?
First... yes, it's all gray-scaled for a reason. Anyway... I'm trying to make a scene where the closet is empty (both pants and shirt slots are at index 0) then, as soon as the player presses a shirt or pants arrow, it will either add one (right arrow) or subtract one (left arrow) to that article of clothing, switching to the next one. There are only three each, so it would be ideal for the arrows to loop around in functionality once at the end, if that makes sense... how to make it go from index 3 to index 1, or index 1 to index 3. I've made everything (except the clothes sprites and background) as buttons... In summary, I'm basically trying to make an outfit-picker for this level. Sorry if that was all confusing, I can be bad with words... thank you, and have a good day!
About this post
- Posted
- Archived
- Score
- 2 · 100% up
- Kind
- Image
- ID
- tglehs
2 comments
Would have helped if you included some code.
Click on left arrow calls next(-1), click on right arrow calls next(1),
or you create separate next() and back() functions.
int currentIndex = 0;void next(int dir){int index = currentIndex + dir;if(index <= 0){currentIndex = clothesArray.length -1;}else if(index >= clothesArray.length){currentIndex = 0;}else{currentIndex = index;}}Thank you! And sorry, I hadn't included code yet, as I didn't want to mess it up early