Legendracula's Forum Posts

  • 15 posts
  • 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.

  • 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.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • That won't be an issue. On any of the six levels you can't kill a Baddie before 5 seconds.

    I think I have found the exact issue, but don't know how to resolve it. It is as you suspected.

    The line "Heroes on Destroyed" -> Local Storage -> set "baddiecount" to BaddieCount doesn't save until the following play through. Something is stopping the newest data from saving. I have tested many times and it always saves the score from the previous playthrough, not the one I just finished.

    For reference, this is what happens to end the layout. The first event "destroy heroes" is what triggers save event, but it's a separate event entirely. This Life event is below the saving event in the list of code. Not sure if that matters.

    Also, I have a few of these saves happening, one for all monsters, one for a specific monster and one for a Boss monster (defeat boss 5 times to unlock). Could they be interfering with each other?

  • Okay,I can fix the second part with a condition.

    Does the rest of the code look okay though? If things did work instantly, would you expect this code to do what I want it to do? For whatever reason, I have a lot of trouble making sense of Local Storage events.

    I'm trying to figure out the timing and where the critical point is. I have so much trouble making sense of this though.

  • I have a clunky save system in my game that only works at a certain time.

    This is what I want to happen:

    -Each time an enemy gets destroyed, Add 1 to Baddie Count.

    -When the hero dies, save the storage item as the current BaddieCount.

    -On loading a new layout(the Main Menu), set BaddieCount to the saved item.

    -Continue this loop for each play-through, so that BaddieCount will keep adding, even after the game is closed.

    Once BaddieCount reaches 500, a new character will be unlocked.

    What is happening:

    Everything works as expected, but the LocalStorage doesn't save until I complete a second playthrough.

    For example when playing through de-bugmode:

    Round 1, I kill 20 enemies, BaddieCount sets to 20. I close game. Baddie count is back to 0.

    Open again. Round 1, I kill 20 enemies, BaddieCount sets to 20. Round 2, I kill 10 more enemies, BaddieCount sets to 30. Now If I close the game and open, the BaddieCount will be set to 20, not 30.

    It's as if my data is saving one play-through too late. Any ideas on how I can fix this? I have included an image of the relevant code.

    Thanks

  • 15 posts