Skip to content

How to use the arrows to switch between clothes?

Not downloaded yet

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!

https://preview.redd.it/n6kkaurom0o81.png?width=1920&format=png&auto=webp&s=4ca00cc1b6b67072a1b466cac663f189fce9f392

2 points2 comments
Open on Reddit
About this post
Posted
Archived
Score
2 · 100% up
Kind
Image
ID
tglehs

Author

12
posts
31
comments
3
media
View profile

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;

}

}

2 points

Thank you! And sorry, I hadn't included code yet, as I didn't want to mess it up early

2 points

Keyboard shortcuts

Move and act

jork
Next / previous post or comment
Enteroro
Open the post
f
Open the media viewer
s
Save
h
Hide (the toast has Undo)
Tab
Right after an action: the toast's Undo
x
Collapse the comment
v
Next layout: cards, compact, grid

Go to

/
Search
gthenh
Home
gthena
All
gthens
Subreddits
gthenl
Library
?
This list
Esc
Close a menu or this list

In the viewer

←or→
Previous / next file
↑or↓
Previous / next post
korj
Previous / next post
Space
Play / pause
m
Mute
z
Zoom
s
Save
o
Open the post (on its own page: back to it)
Esc
Close

Keys do nothing while you type in a box.