Enemy Doesn't Die

11clock11clock Member Posts: 450
edited November -1 in Working with GS (Mac)
http://iliveinavillage.tk/up/5f7b0f9d72d8c48ae4fe2553eba39cdb.png

These are my enemy's attributes and the rules that are supposed to kill the enemy when tapped 4 times. However, this doesn't appear to work. I don't see the problem, so can you help?

Comments

  • RHRH Member Posts: 1,079
    What is self.harm?

    Remove that and just have when actor is touched changed self.health to self.health -1

    That should fix it.
  • quantumsheepquantumsheep Member Posts: 8,188
    Put in an 'otherwise' self.harm=o in the first rule where you change harm to 1

    Dr. Sam Beckett never returned home...
    Twitter: https://twitter.com/Quantum_Sheep
    Web: https://quantumsheep.itch.io

  • SkyMapleSkyMaple Member Posts: 817
    you said when attribute "harm" equals 1 -> Change attribute "health" to -1

    The problem is that "harm" does not equal 1. Its set at 0

    Just use this->

    Rule when touch is pressed-

    change attribute "health" to "health"-1

    EDIT: DARN! too late :)
  • 11clock11clock Member Posts: 450
    self.Harm is to judge if you can harm the enemy. It turns off and on using a timer not seen in the screenshot. The image of the enemy also changes (that works at least).
  • JeffreyShimaneJeffreyShimane Member Posts: 372
    At what point does self.Harm = 1? Perhaps it's not getting set anywhere so self.Health never gets reduced. If you want the health to go down by 1 whenever the actor is touched by the player, I don't think you need the self.Harm rule.
  • 11clock11clock Member Posts: 450
    self.Harm equals 1 after every other second passes. It turns off and on. The enemy is supposed to be invincible unless it is still, when self.Harm equals 1.
  • 11clock11clock Member Posts: 450
    I just tested removing self.Harm. Doesn't change anything.
  • JeffreyShimaneJeffreyShimane Member Posts: 372
    So you removed self.Harm from the equation and you still cannot get self.Health to reduce by 1 every time the actor is touched? Have you tried using Display Text in the actor to show what the current value of self.Health is? That way, you can see if it's changing at all.
  • SkyMapleSkyMaple Member Posts: 817
    Is the actor in the scene locked?
  • 11clock11clock Member Posts: 450
    It is not locked.

    I'll try using Display Text.
  • 11clock11clock Member Posts: 450
    EDIT: Nevermind.
  • 11clock11clock Member Posts: 450
    I added in Display Text and set it to display self.Health, but nothing showed up at all.

    Also, my game's FPS dropped dramatically.
  • JeffreyShimaneJeffreyShimane Member Posts: 372
    Make sure Display Text is not in a rule. For testing purposes, you want it showing the value of self.Health as long as the actor exists.
  • 11clock11clock Member Posts: 450
    It is not in a rule. I have it at the very bottom of the list (not the top because it seemed to cause the change velocity attribute to malfunction).

    Would you like me to send my game file?
  • quantumsheepquantumsheep Member Posts: 8,188
    Try putting in a timer:

    After .1 second
    Then put in your self.health stuff

    Cheers,

    QS :)

    Dr. Sam Beckett never returned home...
    Twitter: https://twitter.com/Quantum_Sheep
    Web: https://quantumsheep.itch.io

  • 11clock11clock Member Posts: 450
    That doesn't work.

    I just tested what changing Health to 0 does, seeing if the enemy will die instantly. The enemy was still alive when I ran the preview. Destroying the actor does not work is what appears to be the problem.
  • 11clock11clock Member Posts: 450
    Here is the game file.

    *link removed*

    Please look at the enemy called Worm.
  • 11clock11clock Member Posts: 450
    I discovered the problem! Turns out when adding an expression I can't type in the variables manually and I must use the dropdown menu. <.<
Sign In or Register to comment.