Legendracula's Recent Forum Activity

  • Awesome. It works.

    Thank you!

  • Yes, code similar to this would be replicated 40 time (80 with crits) I am not a strong coder.... more of a game designer. I know its' inefficient.

    Would this solution not cause the 5% life leech to be added constantly?

    Is there a way to trigger an event "when monster health changes"? or "when health is subtracted from monster"? Then I can have one single event which would apply to any damage they receive.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • I'd like to incorporate a method for my player to leech life from enemies based on the damage of each attack.

    The image below shows how damage is calculated in my game. It's a bit complicated, since there are many possible debuffs the monsters could have to increase the damage taken.

    I want to take 5% of the damage dealt and add it to player health.

    What I have done so far is add another line below it "Add to Health -> Damage calculation*0.05", but this is very cumbersome. I have 40 different attack types in this game, and I am looking for a simpler way to do this.

    Is there a way to store the damage value each time a monster takes damage and use that in a calculation to add player health?

    Thanks.

  • In writing my reply, I found the solution.

    Adding a condition "every 3 second" solved the problem.

  • Tried both fixes and I am still having the same problem.

    I want to be able to stack as many stacks as possible within three seconds to reward attack speed and player skill.

    In testing, it works at first. If I add 5 stacks, it will subtract 5 health at the 3 second mark. But the 6th and 7th bullets that collide will do damage immediately. It's as if the 3 second wait from the 4th and 5th shots is still counting and causing the second bomb to detonate earlier.

    I need some kind of condition or set up that will only allow it to detonate at the 3 second mark and only at the 3 second mark.

  • The goal:

    Hit enemies with a seed projectile which will explode in 3 seconds.

    The more stacks of seed the target has, the more damage it will do. At the time of explosion, stacks should return to 0.

    In Practice:

    This works accordingly. If I apply one, two or three stacks(seedbomb instance variable), it will do the appropriate amount of damage.

    However, after that, each and every hit will subtract one health from the monster as soon as the projectile hits. If I wait a few seconds and try again, the projectile will work as expected.

    My guess is that something is not resetting properly with the 3 second timer and I cannot figure out why.

  • Been thinking about it and I think I got it.

    Four global variables bullet, bomb, nova, orbit

    When FIRE is placed on bullet, add 1 to globalbullet

    When Air is place on bullet, add 50 to gloablbullet

    When EARTH is placed on bullet, add 150 to global bullet

    When WATER is placed on bullet and 400 to bullet.

    Then, every one of my 14 combinations will make globalbullet a unique integer. I can set the sprite accordingly when globalbullet = x.

  • Wow, this is so elegant. I love this. Thank you for sharing these ideas with me.

    I still come across the problem of being able to tell the engine which of those templates to select. And it needs to be changeable. If the player puts FIRE in my first slot, choose fire, but when the player puts air in the second slot, it must change to lightning.

    I am so ready to make this game and have all the mechanics ready to go, this single thing is really holding me up though.

  • Alright, as a grade school teacher who is entirely self taught. This is mostly greek to me. I haven't used functions yet, or any string variables.

    This probably took you, what, five minutes to put together? Hah, it will likely take me hours to unpack these concepts, research them and implement them.

    I like the array you set up and I could easily expand it for all 10-14 bullet types.

    I was planning on doing most of my damage and modifier coding directly on each sprite. When certain variables are true, the player will instead spawn the fire bullet, or steam bullet etc. When that specific sprite collides with an enemy, damage occurs as well as the other element-specific effect.

    Would it be possible to use the first two columns to identify what the element will be and then use a third column to determine what the resulting projectile would be?

  • I'm not a very good coder, so I would use some cheesy workarounds.

    First I'd make my "level select layout" with all the sprites exactly where I want them.

    Like brushfe said, set up a global boolean for each level.

    On start of layout, if LEVEL1 boolean is FALSE, move the level icon to a coordinate right outside of the layout where it can't be accessed.

    If it's TRUE, nothing happens and the icon stays exactly where it is.

    In my game, if sprite is overlapping LEVEL1ICON and spacebar is pressed, start Level 1. If the icon is off screen and inaccessible, that condition can't be met.

  • I am going to make a new game based on the four elements(fire,earth,water and air). It will be a top down survival shooter.

    The core mechanics are that the player has 4 types of attack. (bullet, bomb, nova and orbit)

    At certain points, the player can permanently infuse their attacks with one of the four elements. i.e. drag and drop FIRE onto your "bullet" slot and the bullet becomes a fire bullet.

    Each attack, can be modified by two elements. EARTH + FIRE = LAVA.

    This means 10 possible combinations (14 if I allow same element stacking)for each of the four attacks.

    That's 40-56 unique attacks for me to code, which isn't the problem. I can code all of the actual game mechanics, such as damage, choosing sprite, special effects etc.

    What I need is an elegant way to track which modifiers each attack has and then a way for the engine to determine which modified attack to start using. I wanted to have a menu that you place the elements onto. In a very simple setting, I would code this.

    FIRE is overlapping BULLET1 -> set firebullet boolean true.

    FIRE is overlapping BULLET1

    EARTH is overlapping BULLET2 -> set lavabullet boolean true

    Clearly, this will be quite cumbersome with 40+ attacks as well as having to account for two slots per attack. Unfortunately, I am a hopeless visionary, and not much of a coder...

    My friend suggested using an array, but I have no idea how to tie arrays to work with variables. Does anyone have a suggestion?

    Thanks

  • I finally got it to work! This was the last bug keeping my "beta" version from sending to my friends to test. Thank you for all the help and suggestions Headbang Games.

    I went through all my code and assured that each "set item" would only happen once, either through a trigger, or by setting a second condition. Then I added an All Sets Complete sub-event to my Life =0 event. Picture below.

    I'm a 7th grade teacher and just do this as a hobby to teach my students some coding. Maybe dictionaries will be the next thing for me to explore.

Legendracula's avatar

Legendracula

Member since 6 Mar, 2021

None one is following Legendracula yet!

Trophy Case

  • 3-Year Club
  • RTFM Read the fabulous manual
  • Email Verified

Progress

5/44
How to earn trophies