I've tried following this tutorial, but it does not work for me.
https://blog.argentgames.co/post/175471 ... s-in-renpy
It currently looks like this
https://i.imgur.com/uTk114z.png
I want to try and make it from scratch though, in a new game, because the coding in my current game is a bit messy.
this is my current script
Code: Select all
init python:
dressup_button_show = False
hair, glasses, tie, shirt, pants = 1, 1, 1, 1, 1 # default dressup items
hair_styles_num, glasses_styles_num, tie_styles_num, shirt_styles_num, pants_styles_num = 7, 4, 4, 3, 3 # number of styles (files) for each dressup item
# define images as:
# "base.png" for the base image
# "hair1.png", "hair2.png", "hair3.png", ... - start with 1 and end with (hair_styles_num)
# "glasses1.png", "glasses2.png", "glasses3.png", ... "tie1.png", "tie2.png", ... "shirt1.png", "shirt2.png", ... "shirt1.png", "pants2.png", ...
import os, time, pygame
def draw_char(st, at): # combine the dressup items into one displayable
hue1 = im.matrix([ 1, 0, 0, 0, 0,
0, 1, 0, 0, 0,
0.85, 0.7, 1, 0, 0,
0, 0, 0, 1, 0 ])
hue2 = im.matrix([ 1, 0, 0, 0, 0,
0, 1, 1, 0, 0,
0.85, 0.7, 1, 0, 0,
0, 0, 0, 1, 0 ])
hue3 = im.matrix([ 1, 0, 0, 0, 0,
0, 1, 0, 0, 0,
0.85, 0.7, 1, 0, 0,
0, 0, 1, 1, 0 ])
hue4 = im.matrix([ 1, 0, 0, 0, 0,
0, 1, 0, 0, 0,
0.85, 0.7, 1, 0, 0,
0, 0, 0, 1, 0.5 ])
hue5 = im.matrix([ 1, 0, 0, 0, 0,
0, 1, 0, 0, 0,
0.85, 0.7, 1, 0, 0,
0, 1, 0, 1, 0 ])
hue6 = im.matrix([ 1, 0, 0, 0, 0,
0, 0, 0, 0, 0,
0.85, 0.7, 0, 0, 0,
0, 0, 0, 1, 0 ])
hue7 = im.matrix([ 1, 1, 1, 0, 0,
0, 1, 1, 0, 1,
0.85, 0.7, 1, 0, 0,
0, 0, 0, 1, 0 ])
huearray = [hue1,hue2,hue3,hue4,hue5,hue6,hue7]
globals()["doll"] = im.Composite(
(361, 702), # image size
(0, 0), "base.png",
(0, 0), "glasses%d.png"%glasses, # (0, 0) is the position of a dressup item. Because these images are saved with spacing around them, we don't need to position them.
(0, 0), im.MatrixColor("hair%d.png"%hair, huearray[hue]),
(0, 0), "shirt%d.png"%shirt,
(0, 0), "tie%d.png"%tie,
(0, 0), "pants%d.png"%pants
)
if globals()["direction"] == -1:
globals()["doll"] = im.Flip(globals()["doll"], horizontal=True)
return globals()["doll"],.1
def draw_char_side(st, at):
return LiveComposite((361,702), (10,550), im.FactorScale(globals()["doll"], .45)),.1
dressup_show = False
dressup_button_show = False
hair, glasses, tie, vest, skirt, hue = 1, 1, 1, 1, 1, 0 # default dressup items
hair_styles_num, glasses_styles_num, tie_styles_num, vest_styles_num, skirt_styles_num, hue_styles_num = 7, 4, 4, 3, 3, 6 # number of styles (files) for each dressup item
# DEFINE CHARACTERS HERE!!!!! <---------------------------------------------------------
#
define pov = Character(_("[povname]"), color="#FF69B4", show_side_image=DynamicDisplayable(draw_char_side))
define l = Character('Lea', color="#c8ffc8")
define a = Character('Aden', color="#AE0D0D")
define u = Character('???', color="#FFFFFF")
define t = Character('Teacher', color="#FFFFFF")
#
#
# BGS GO HERE!!!!! <---------------------------------------------------------
#
image ccbg = "bg.png"
label start:
scene black with fade
"In this game you play as a girl. You can change your character's appearence and name."
"Let's start with the name."
python:
povname = renpy.input("Type your character's name bellow.")
povname = povname.strip()
if not povname:
povname = "Emily"
"[povname], is that right?"
label justtobesure:
menu:
"Yes":
jump charactercreation
"No":
$ povname = ""
jump redoname
label redoname:
python:
povname = renpy.input("Well, what is your name?")
povname = povname.strip()
if not povname:
povname = "Emily"
"[povname], is this right?"
jump justtobesure
init:
image char = DynamicDisplayable(draw_char) # using DynamicDisplayable ensures that any changes are visible immedietly
$ character = Character('Koma', color="#c8ffc8", window_left_padding=180, show_side_image=DynamicDisplayable(draw_char_side))
label charactercreation:
$direction = 1
$doll = im.Composite(
(361, 702), # image size
(0, 0), "base.png",
(0, 0), "glasses1.png",
(0, 0), "hair1.png",
(0, 0), "shirt1.png",
(0, 0), "tie1.png",
(0, 0), "pants1.png"
) # We have to set the variable at start, but Ren'Py will sometimes crash ("can't construct the image in draw_char()") if we set it to None
show screen dressup_button
$ dressup_button_show = True
label cont:
show char
character "La, la, la!"
jump cont
screen dressup_button: # a button to call the dressup game
if dressup_button_show:
vbox xalign 0.01 yalign 0.01:
textbutton "Change look." action ui.callsinnewcontext("dressup")
label dressup:
show char:
xpos 250
python:
# display the arrows for changing the dress:
y = 20
ui.imagebutton("arrowL.png", "arrowL.png", clicked=ui.returns("hueL"), ypos=y, xpos=100)
ui.imagebutton("arrowR.png", "arrowR.png", clicked=ui.returns("hueR"), ypos=y, xpos=300)
y += 80
ui.imagebutton("arrowL.png", "arrowL.png", clicked=ui.returns("hairL"), ypos=y, xpos=50)
ui.imagebutton("arrowR.png", "arrowR.png", clicked=ui.returns("hairR"), ypos=y, xpos=400)
y += 80
ui.imagebutton("arrowL.png", "arrowL.png", clicked=ui.returns("glassesL"), ypos=y, xpos=50)
ui.imagebutton("arrowR.png", "arrowR.png", clicked=ui.returns("glassesR"), ypos=y, xpos=400)
y += 80
ui.imagebutton("arrowL.png", "arrowL.png", clicked=ui.returns("tieL"), ypos=y, xpos=50)
ui.imagebutton("arrowR.png", "arrowR.png", clicked=ui.returns("tieR"), ypos=y, xpos=400)
y += 80
ui.imagebutton("arrowL.png", "arrowL.png", clicked=ui.returns("shirtL"), ypos=y+80, xpos=50)
ui.imagebutton("arrowR.png", "arrowR.png", clicked=ui.returns("shirtR"), ypos=y+80, xpos=400)
y += 80
ui.imagebutton("arrowL.png", "arrowL.png", clicked=ui.returns("pantsL"), ypos=y+160, xpos=50)
ui.imagebutton("arrowR.png", "arrowR.png", clicked=ui.returns("pantsR"), ypos=y+160, xpos=400)
ui.textbutton("Return", clicked=ui.returns("goback")) # image button version: ui.imagebutton("return.png", "return_hover.png", clicked=ui.returns("goback"), ypos=0, xpos=0)
ui.textbutton("Start Game", clicked=ui.returns("Start Game")) # image button version: ui.imagebutton("return.png", "return_hover.png", clicked=ui.returns("goback"), ypos=0, xpos=0)
$ picked = ui.interact()
# based on the selection, we increase or decrease the index of the appropriate dress up item
if picked == "hueL":
$ hue = hue - 1 # if previous hair is chosen
if hue < 0: # making sure we don't get out of index range (index -1 is not allowed)
$ hue = hue_styles_num
if picked == "hueR":
$ hue = hue + 1 # if next hair is chosen
if hue > hue_styles_num : # making sure we don't get out of index range (index musn't be bigger than hue_styles_num)
$ hue = 0
if picked == "hairL":
$ hair -= 1 # previous hair
if picked == "hairR":
$ hair += 1 # next hair
if hair < 1: # making sure we don't get out of index range (index 0 is not allowed)
$ hair = hair_styles_num
if hair > hair_styles_num: # making sure we don't get out of index range (index musn't be bigger than hair_styles_num)
$ hair = 1
if picked == "glassesL":
$ glasses -= 1
if picked == "glassesR":
$ glasses += 1
if glasses < 1:
$ glasses = glasses_styles_num
if glasses > glasses_styles_num:
$ glasses = 1
if picked == "tieL":
$ tie -= 1
if picked == "tieR":
$ tie += 1
if tie < 1:
$ tie = tie_styles_num
if tie > tie_styles_num:
$ tie = 1
if picked == "shirtL":
$ shirt -= 1
if picked == "shirtR":
$ shirt += 1
if shirt < 1:
$ shirt = shirt_styles_num
if shirt > shirt_styles_num:
$ shirt = 1
if picked == "pantsL":
$ pants -= 1
if picked == "pantsR":
$ pants += 1
if pants < 1:
$ pants = pants_styles_num
if pants > pants_styles_num:
$ pants = 1
if picked == "goback":
return
if picked == "Start Game":
jump confirmlook
jump dressup # we don't want to return on every click, this jump loops until we click on "back" button
label confirmlook:
"Is this how your character looks?"
menu:
"Yes":
jump continuegame
"No":
jump dressup
label continuegame:
scene black with fade
hide char
pov "This is how I look!"
"This is random text to see where it goes"
return