Discuss how to use the Ren'Py engine to create visual novels and story-based games. New releases are announced in this section.
Forum rules
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
I'm attempting to make an outfit/sprite gallery inside of my game's regular gallery. In theory, I'm trying to make it so that clicking on arrows next to the sprite causes a different variation of the sprite to pop up in place of the sprite already there like so:
so far I have added and initialized a variable so I know which sprite to show
I figure there has to be a way to do this, whether with or without SetScreenVariable() or something else. If anyone knows an easier or correct way to go about this, it would be a great help! I've searched about to see if anyone had posted about making a sprite gallery but I couldn't find anything.
Last edited by lacrimoosa on Sat Mar 28, 2020 8:09 pm, edited 1 time in total.
An artist/writer/programmer working to get mine and my partner's ideas out into the world through Red & Pink Games!
"Oh geez, looks like the code just broke."
init python:
from collections import deque
default dress_list = deque(range(3)) # here three dresses.
# bla bla bla the screen
textbutton "Next" action Function("set_dress",1)
textbutton "Prev" action Function("set_dress",-1)
init python:
def set_dress(amount):
dress_list.rotate(amount)
return True
Now, dress_list[0] is always the value of the dress to show.
If you want to debate on a reply I gave to your posts, please QUOTE ME or i'll not be notified about. << now red so probably you'll see it.
gas wrote: ↑Sat Mar 28, 2020 6:59 pm
The easier thing that come to my mind is to use a DEQUE (a special list that have stack functions) and a Function() action.
init python:
from collections import deque
default dress_list = deque(range(3)) # here three dresses.
# bla bla bla the screen
textbutton "Next" action Function("set_dress",1)
textbutton "Prev" action Function("set_dress",-1)
init python:
def set_dress(amount):
dress_list.rotate(amount)
return True
Now, dress_list[0] is always the value of the dress to show.
Thank you! That is exactly the thing I had in mind! I knew about stacks because of general OOP knowledge, but I had no idea how to work it with ren'py syntax.
An artist/writer/programmer working to get mine and my partner's ideas out into the world through Red & Pink Games!
"Oh geez, looks like the code just broke."