[Solved]Where have I gone wrong with this code?

  • Ok so during this boss fight, if I destroy the right gun first the health bar over the left gun dissapears. If I destroy the left gun first the healthbar on the right gun stays fine, I've looked over it and over it and over it again and just can't see what i've done wrong that would cause this to happen on the right gun being destroyed first. I've highlighted the section of code that controls the gun health section but have included the whole block of code for the boss in case it's needed.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Ok so during this boss fight, if I destroy the right gun first the health bar over the left gun dissapears. If I destroy the left gun first the healthbar on the right gun stays fine, I've looked over it and over it and over it again and just can't see what i've done wrong that would cause this to happen on the right gun being destroyed first. I've highlighted the section of code that controls the gun health section but have included the whole block of code for the boss in case it's needed.

    look at this code everything seems ok.

    check it out well all objects name, variables and image points, or post a .capx

    because there are so many things that can affect the problem and from the piece of code can not be verified

  • Run your game in debug mode (Ctrl-F4), select each health bar sprite, see where they are located before and after you destroy the gun, which one of them gets destroyed etc.

  • debug is the only way you can know or check if you mix up the name with both hands or the instance variable

  • Run your game in debug mode (Ctrl-F4), select each health bar sprite, see where they are located before and after you destroy the gun, which one of them gets destroyed etc.

    ok so the right gun does get destroyed, left gun is still there but the Y value for the healthbar gets set to 0 on right gun destroyed, x value still stays with the ships movement and changes as the ship moves. Now that I know where to look I do see the healthbar moved up to the top of the screen. They both did have the behavior of pin as I tried that initially but couldn't set it to an image point so did manually. Tried removing the pin behavior just in case but that didn't change anything. What kinds of things might cause that to happen?

  • dop2000 NN81 wizdigitech

    Aha! I see it lol, it's there in the code the left gun Y is set to Right gun Y just too much time looking at RG LG lol maybe in the future it will be better to put a few more letters in there to differentiate and better spot stuff like that

    thank you all for your help it is most appreciated!

  • dop2000 NN81 wizdigitech

    Aha! I see it lol, it's there in the code the left gun Y is set to Right gun Y just too much time looking at RG LG lol maybe in the future it will be better to put a few more letters in there to differentiate and better spot stuff like that

    thank you all for your help it is most appreciated!

    AAARRHHRRHHGHHH

    i miss it

    sorry

  • > dop2000 NN81 wizdigitech

    >

    > Aha! I see it lol, it's there in the code the left gun Y is set to Right gun Y just too much time looking at RG LG lol maybe in the future it will be better to put a few more letters in there to differentiate and better spot stuff like that

    >

    > thank you all for your help it is most appreciated!

    >

    AAARRHHRRHHGHHH

    i miss it

    sorry

    haha no worries, i think with all the LG in there when your mind see's the RG it just mixes in with all the LG and you scan right over it.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)