Choosing characters at the start of the game
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.
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.
-
- Regular
- Posts: 51
- Joined: Tue Jul 17, 2018 10:32 am
- Location: Philippines
- Contact:
Choosing characters at the start of the game
I would like a game that will let you choose your character at the beginning. For example, a male and a female, each assigned with their own character sprites. How will I do that?
Re: Choosing characters at the start of the game
Well, there are definitely multiple ways of doing that. But if I had to, I would start by making a character with a name that is based off of a variable and an image.
You'll then want to predefine the image "playerImage" with another variable.
After that, you can set up a menu either using the "menu:" option or through screens. I used a simple menu that changes the name and the image's file destination depending on which option you chose.
I wouldn't doubt that there's a more efficient way of doing it, but that's the first thought that came to my head.
Code: Select all
define p = Character("[player]", image = "playerImage")
default player = "Example"
Code: Select all
default gender = ""
image side playerImage = "[gender]"
Code: Select all
menu:
"Male":
$ player = "Tom"
$ gender = "player/male.png"
"Female":
$ player = "Eileen"
$ gender = "player/female.png"
Who is online
Users browsing this forum: Bing [Bot], Google [Bot], Rhapsy