I don't know anything about python, I'm just guided by the codes they provide here in the forum.
I have applied this code of gradual change in the animation speed of a half body jumping.
And I want to modify the outfit and hair, but when I add them to the screen the images are not synchronized.
viewtopic.php?t=60827
Code: Select all
init:
$ hair = False
$ clothes = False
#################################3
image Fidget base:
function var_speed_base #
image Fidget hair:
function var_speed_hair #
image Fidget clothes:
function var_speed_clothes #
default frame_num = 1
default anim_speed = 0.3
# The game starts here.
init python:
def var_speed_base(trans, st, at): #### BASE BODY
trans.set_child("images/px/body_{}.png".format(store.frame_num))
store.frame_num +=1
if store.frame_num > 14:
store.frame_num = 1
return store.anim_speed
def var_speed_hair(trans, st, at): #### HAIR
trans.set_child("images/px/hair_{}.png".format(store.frame_num))
store.frame_num +=1
if store.frame_num > 14:
store.frame_num = 1
return store.anim_speed
def var_speed_clothes(trans, st, at): #### CLOTHES
trans.set_child("images/px/clothes02_{}.png".format(store.frame_num))
store.frame_num +=1
if store.frame_num > 14:
store.frame_num = 1
return store.anim_speed
label start:
call screen custom
return
#############################################SCREENS
screen c_velocidad:
vbar:
value VariableValue("anim_speed", 0.3, max_is_zero=False)
xsize 50
ysize 500
yalign 0.5
bar_invert True
screen menu_custom:
tag menu
zorder 100
frame:
vbox:
textbutton "HAIR":
if hair == True:
action SetVariable("hair", False)
else:
action SetVariable("hair", True)
textbutton "CLOTHES":
if clothes == True:
action SetVariable("clothes", False)
else:
action SetVariable("clothes", True)
use c_velocidad
screen custom:
add "Fidget base"
if hair:
add "Fidget hair"
if clothes:
add "Fidget clothes"
use menu_custom
Here I leave the "Test"
https://drive.google.com/file/d/1aXz4fW ... drive_link
And thanks in advance to whoever can help.