EBF5: Foe Code Sample

Since people seem to be interested in code samples, here’s the code for a simple foe in EBF5.
Bigger foes differ in that they have more complicated attack patterns and more attacks.

sample foe

33 thoughts on “EBF5: Foe Code Sample

  1. Shraderc.inc

    so this is for the dark idol or the holy idol whichever way you orient the resistances

    from the look of it holy from the attacks

    Reply
    1. Drake

      I’m pretty sure it’s holy. Since it is a multiplier, when damage is applied any multiplier 1 in more damage taken. -1 would mean absorption because if you multiply a negative number in a damage formula the result will be negative aswell, so negative damage = healing. At least I can’t imagine a dark foe which absorbs holy power :yay:
      Another indicator for a holy idol is attack (3).

      /killing time

      Reply
      1. Drake

        some text got lost in line 2. About the multiplier:
        bigger 1 means more damage taken
        smaller 1 means less damage taken

        Reply
  2. Lathryn

    You know those moments when you take a look at this and then say: “Wow, coding looks so easy!”
    And then you try it out, and then… You created some spaghetti by accident.

    Looks mighty fine, btw! :love: :love2:

    Reply
  3. Crepo7351

    I’m not a coder [yet], but I’d say that Mecha Lance (as I’ve called him) ought to be the most interesting Evil Player to fight due to his final attack. :smirk:

    Reply
    1. Matt Roszak Post author

      I’d have to remake most of EBF from scratch, and that’s not something I want to do. Would rather work on something new in that case.

      Reply
  4. Cody

    Could you go through what the new positive/negative status effects do? I remember you said roughly what you were planning for a couple, but I am pretty curious about all the others.

    Reply
    1. Drake

      It would be great if status effect and weapon effect chance would transparent to the player, giving us an Info about %chance in the ability and weapon description. Hidden and unpredictable coefficients (stronger skills should always have better ones) aren’t that great imo.

      And it’s good to keep some secrets. Discovering is an essential part for enjoying the game :smirk:

      Reply
  5. SomeRandomWeeb

    Matt. I’m SO FUCKIN IMPRESSED by your coding skills.
    What language are you using (I guess it’s some C or C++ or C# stuff) ? Could you ever do code teaching videos ? Anyways, keep up the good work ! :D :yay:

    Reply
    1. Matt Roszak Post author

      ActionScript 3. I think coding is too hard for me to teach, at best I can explain some specific examples.

      Reply
      1. Shraderc.inc

        working in scratch right now pretty cool game me and my friends have made as a hobby over the last year that uses random enemy and attack generation with 15 enemys and traps and 5 bosses (not all made yet) if you want to see i could send you a beta with instructions.

        Reply
      2. goldenPi Games

        Well, this is certainly a very good specific example! I look at it for reference sometimes, just on how Flash syntax works, since I’m used to Java and learning Flash.

        Reply
  6. Flashlight237

    If I can ask… Since it turns out foes DO have an attack stat set for them, how does foe damage work? Best interpretation I can come up with is, unlike player damage (which used a simple formula), foe damage is scaled off the foe’s level.

    Reply
    1. Drake

      If I assume it right each kind of attack/action has it’s own set of modifiers. I believe the enemy level is one of those but more like difficulty level, skill factor(like basic attack = 1, heavy attack = 2…), champion type (like those stronger versions of regular monsters), equipped weapon (if there will be any which isn’t just cosmetic) might be existent aswell . Ofc there will be also a formula with many multiplier to determine final damage which is using the stats of all involved characters, resistance values and buffs/debuffs.

      Now I can’t say how Matt codes this function but what I did state would be things which I would consider.

      Sidenote: the coding reminds me to times when I was learning ‘Visual Basic’.

      Reply
  7. Sticks

    I apologize for this not being anything about really…anything. But I know this probably isn’t a game genre you’re into but i’d recommend playing the game OneShot, its $10 on Steam and its a very original puzzle/adventure sort of game.

    Reply
  8. Crow

    The first thoughts in my mind:
    “That looks like C#.”
    “That looks like a lot of code repetition. Couldn’t he use an array?”
    “No… wait. This would be easier to edit. Still looks like a lot of magic numbers.”
    “But wait, that’s just initialization. They’re used once and then done. And if he wants to change anything, then just open the file, find the stat, and change one number.”
    “And he could use a template file so foes are easy to make!”

    I was critical at first, but the longer I looked at it, the better it seems. I suppose if I changed anything, I’d change the string literals and “Icon = 1079″ for consistency, but I’m guessing the strings are for filenames, and the icons are an index (instead of a long, descriptive name). I’m guessing this is because you have a manageable number of animations for lookup (so description is easy), but a ton of icons (so description is cumbersome).

    Questions: The names “attack1″ and “attack3″ kind of threw me off; where’s attack2? Why do you add 10 to the generated skin? Why not just 0, 1, and 2 instead of 10, 11, 12? And what’s with {Items.coffee, 0}? They drop 0 coffees? Then why put it there in the first place?

    Just some things that popped into my head while reading the code. This was pretty cool to see; thanks for posting!

    Reply
    1. Spirare

      If you look through the older enemy previews, the attack numbers are shared by all enemies of that type rather than on a per-enemy basis – In this case, Idols.

      He created at least 6 attacks to be used by Idols, many of which are shared between several types. Gem idols can use attacks 1, 3 and 6, but 2, 4, and 5 can only be used by other types of idols.

      Reply

Leave a Reply to Spirare Cancel reply

Your email address will not be published. Required fields are marked *

Simple HTML is allowed. Spam will automatically be deleted. Here's some emoticons:

:smirk: :yay: :hurray: :ooo: :tongue: :love: :love2: :stars: :sad: :neutral: :meh: :bleh: :cry: :sick: :scared: :shades: :mad: :wut: :?: :!: :arrow: more »