Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines
(1 edit)

does anyone know if it's possible to code in multiple icons for different characters? i've tried doing additional ifs and elif but nothing worked.

There is a way. In one of my games, I ended up having to create a phone text code and repeating it several times for each character, including te background and the icon for their texts. Even for the separate images. I created a screen for each character such as this example. It allows the background to change and the icons to work correctly the way I needed them to. 

screen nvl_phonetext_mari(dialogue):

    add "/images/phonesystem/windows/mari_phone_back.png"

    style_prefix None

    $ previous_d_who = None

    for id_d, d in enumerate(dialogue):

        if d.who == None:

            text d.what:

                xpos -335

                ypos 0.0

                xsize 350

                text_align 0.5

                italic True

                size 28

                slow_cps False

                id d.what_id

                if d.current:

                    at message_narrator

        else:

            if d.who == MC_Name:

                $ message_frame = "/images/phonesystem/phone_send_frame.png"

            else:

                #print d.who

                $ message_frame = "/images/phonesystem/phone_received_frame.png"

            hbox:

                spacing 10

                if d.who == MC_Name:

                    box_reverse True

                #If this is the first message of the character, show an icon

                if previous_d_who != d.who:

                    if d.who == MC_Name:

                        $ message_icon = "/images/phonesystem/phone_send_icon.png"

                    elif d.who == MC_Mari:

                        $ message_icon = "/images/phonesystem/phone_mari.png"

                    else:

                        $ message_icon = "/images/phonesystem/phone_mari.png"

                    add message_icon:

                        if d.current:

                            at message_appear_icon()

                else:

                    null width 107

                vbox:

                    yalign 1.0

                    if d.who != MC_Name and previous_d_who != d.who:

                        text d.who

                    frame:

                        padding (20,20)

                        background Frame(message_frame, 23,23,23,23)

                        xsize 350

                        if d.current:

                            if d.who == MC_Name:

                                at message_appear(1)

                            else:

                                at message_appear(-1)

                        text d.what:

                            pos (0,0)

                            xsize 350

                            slow_cps False

                            if d.who == MC_Name:

                                color "#FFF"

                                text_align 1.0

                                xpos -580

                            else:

                                color "#ffffff"

                            id d.what_id

        $ previous_d_who = d.who

   
style phoneFrame_mari is default

style phoneFrame_mari_frame:

    ## Change background according to who is texting. Add other backs later

    background Transform("/images/phonesystem/windows/mari_phone_back.png", xcenter=0.5,yalign=0.5)

    foreground Transform("/images/phonesystem/phone_foreground.png", xcenter=0.5,yalign=0.5)

    ysize 815

    xsize 495

style phoneFrame_mari_viewport:

    yfill True

    xfill True

    yoffset -20

style phoneFrame_mari_vbox:

    spacing 10

    xfill True


As you can see, I changed the screen name to the nvl_phonetext(character name)(dialogue). This allowed me to keep the changes between each character.

i'll try this out. thanks!