Page 1 of 1

Health screen with Transform properties I think

Posted: Sat May 28, 2022 5:43 pm
by mrf_22
I just figured out how to make a screen that has that has the player's and enemies health on it so here it is (along with the variables so that the stats are displayed).

Code: Select all


# Flags.

default cur_health = 85
default max_health = 85

default cur_energy = 120
default max_energy = 120

default cur_speed = 10
default max_speed = 10

default cur_strength = 55
default max_strength = 55


default gen_cur_health = 60
default gen_max_health = 60

default gen_cur_energy = 80
default gen_max_energy = 80

default gen_cur_speed = 25
default gen_max_speed = 25

default gen_cur_strength = 20
default gen_max_strength = 20

#-----

# Battle screens here.

screen battle_and_health(): #This is an example of having 2 frames inside 1 screen.
    frame at up_and_down:
        # 
        grid 2 4:
            # spacing 0
            text "HEALTH"
            textbutton _("[cur_health]/[max_health]"):
                action NullAction()

            text "ENERGY"
            textbutton _("[cur_energy]/[max_energy]"):
                action NullAction()

            text "SPEED"
            textbutton _("[cur_speed]/[max_speed]"):
                action NullAction()

            text "STRENGTH"
            textbutton _("[cur_strength]/[max_strength]"):
                action NullAction()

    frame at up_and_down2: # This is gen's health screen.
        xalign 1.0
        grid 2 4:
            # spacing 0
            text "HEALTH"
            textbutton _("[gen_cur_health]/[gen_max_health]"):
                action NullAction()

            text "ENERGY"
            textbutton _("[gen_cur_energy]/[gen_max_energy]"):
                action NullAction()

            text "SPEED"
            textbutton _("[gen_cur_speed]/[gen_max_speed]"):
                action NullAction()

            text "STRENGTH"
            textbutton _("[gen_cur_strength]/[gen_max_strength]"):
                action NullAction()
                
#-----

# Transforms

transform up_and_down: # This is for you, the player's health screen.
    ypos 10
    linear 0.8 ypos 5
    linear 0.8 ypos 10
transform up_and_down2: # This is for gen's, the enemy, health screen.
    ypos 10
    linear 0.8 ypos 5
    linear 0.8 ypos 10
    repeat
So if you wanted to call/show the health screen (the transform script is already coded with the screen itself), you would do:

Code: Select all


label start: #-- I fixed it so that it's just start.
    show screen battle_and_health
    "Generic Enemy" "Wow."
    "Generic Enemy "Let's fight!"
    return
    
Hopefully somebody else can find use from this as well. :D