Page 1 of 1
Choosing characters at the start of the game
Posted: Wed Jan 09, 2019 3:13 am
by MisterHarold
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
Posted: Wed Jan 09, 2019 4:07 am
by Nagibator
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.
Code: Select all
define p = Character("[player]", image = "playerImage")
default player = "Example"
You'll then want to predefine the image "playerImage" with another variable.
Code: Select all
default gender = ""
image side playerImage = "[gender]"
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.
Code: Select all
menu:
"Male":
$ player = "Tom"
$ gender = "player/male.png"
"Female":
$ player = "Eileen"
$ gender = "player/female.png"
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.