Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
Tags

Update

I'm starting to reach the point where the visual programming interface of GB Studio is becoming a hindrance. Scripting interactions with monsters involves some complex conditionals, which I find hard to read when they aren't in text.

A screenshot from GB Studio. The portion of the screen shown is in the scripting sidebar, which shows a snippet of a script that is five layers deep into a nested conditional. Statements that are visible include calling a script called "RollUnder", which rolls a d20 and checks to see if the result is less than a target number, a statement decrementing the character's hit points, and a dialog box displaying speech from a goblin.

So I decided to step back and write out the first of these in pseudocode, which helped a lot with planning the control flow:

ON Trigger.ENTER {
If GOBLIN_COMPLETE is False {
    If GoblinActive is False {
        Display "The goblin is asleep… Try to sneak past? {Stealth}"
        Display.Choice Set Temp0 {
            True : "Yes"
            False : "No"
        }
        If Temp0 is True {
            Call RollUnder(Temp0, PC_Stealth, Temp1)
            If Temp1 is True {
                Display "{Stealth: $Temp0} Success!"
                Scene.change(D1_R2, 16, 9)
                Stop
            }
            Else {
                Display "{Stealth: $Temp0} Failure!"
                Goblin.StopOnUpdate
                Goblin.Emote(Shock)
                Display(avatar=Goblin) "Zzz--wha? Whozzat?"
                Goblin.Move(5,9)
                Display "The goblin approaches!"
                GoblinActive = True
            }
    }
    Loop {
        If Goblin_HP <= 0 {
            Stop
        }
        Else If GoblinComplete is True {
            Stop
        }
        Else If PC_HP <= 0 {
            Display "You collapse from exhaustion and injury!"
            Call PCdead
            Stop
        }
        Else {
            Display "What do you do?"
            Display.Menu Set GoblinWhatDo {
                Attack:1,
                Scare:2,
                Friend:3, 
                Trick:4,                 Escape:0             }         }         If GoblinWhatDo == 1 { \\Attack             Call RollUnder(Temp0, PC_Attack, Temp1)             If Temp1 is True {                 Display "{Attack: $Temp0} Success!"                 Goblin_HP = Goblin_HP - PC_Damage - Equip_Damage                 Display "You strike at the goblin with your weapon!"                 Display(avatar=Goblin) "Arrgh!"             }             Else {                 Display "Attack $Temp1 Failure!"                 Call RollUnder(Temp0, PC_Armour, Temp1)                 Display "The goblin counterattacks!"                 If Temp1 is True {                     Display "You evade damage!"                 }                 Else {                     PC_hp -= 1                     Display "The goblin hits! (1 Damage)"                 }             }         }         Else If GoblinWhatdo == 2 { \\Scare             If GoblinScared == 2 {                 Display "The goblin isn't afraid of you."             }             Else {                 Call RollUnder(Temp0, PC_Scare, Temp1)                 If Temp1 is True {                     Display "{Scare: $Temp0} Success!"                     Display "You frighten the goblin, suggesting that
                         they might be cut to shreds or blasted into                          goo if they attack."                     Display(avatar=Goblin) "Okay, okay! I don't want                                 no trouble!"                     Goblin.move(15, 6)                     GoblinComplete = True                     GoblinScared = 1                     Stop                 }                 Else {                     Display "{Scare: $Temp1} Failure"                     Display "You try to scare the goblin with threats and                          promises, but they aren't impressed."                     Display(avatar=Goblin) "Heh, you think that's scary?                                 Say hello to my little, uh, my
                                knife!"                     Display "The goblin brings the knife a little too                              close to you and grins menacingly. But they                          don't attack yet."                     GoblinScared = 2                                  }         }
        Else If GoblinWhatDo == 3 { \\Friend [...]
Now that I have that mapped out, I can actually implement it in the engine.

Here's the goblin in question, for fun. It's an edit of a sprite from the roguelike repository linked earlier.

An animated GIF of a goblin pixel art sprite doing an idle animation. The goblin is dark green skinned, wearing gold-toned armour, and carrying a gold knife. The idle animation has the goblin tap their foot and wiggle their arms.