Having trouble with game.health attribute

butterbeanbutterbean Member Posts: 4,315
edited November -1 in Working with GS (Mac)
So I have soo many attributes for my main character, and the last one I want to add, game.health is interfering with other rules and attributes, so I will do my best to explain :)

The 3 links are to a rule just for her. Thanks to Codemonkey I got her stomping ability working perfectly!

http://img36.imageshack.us/img36/3403/picture1ww.png

http://img515.imageshack.us/img515/5453/picture2ff.png

http://img180.imageshack.us/img180/1056/picture3r.png

Basically, I've added a global game attribute game.health. And it is integer with a 3 next to it.

In the 3rd link, I've tried adding instead of "destroy this actor"

Game.health = game.health-1

Then I also added another rule, if game.health=0 destroy this actor

It hasn't worked so far with the attempts I've made, and then when she collides with the enemy, her Y velocity kicks in and she moves up like she's jumping.

Not sure how to get rid of this when she collides with such enemy.

Let me know if I need to clarify anything, but this is the last attribute needed for her to get this game rolling :)

Comments

  • butterbeanbutterbean Member Posts: 4,315
    Anyone have any ideas looking at the rules?
  • xactoxacto Member Posts: 146
    I had the same problem, all I did was change the "equals" to "less then" and it worked.

    game.health < 0 destroy this actor

    Not sure if this will help, may need to see more of your code.

    --------------------------------
    StarFire
    http://gamesalad.com/game/play/8901
  • butterbeanbutterbean Member Posts: 4,315
    Hmmmm, I could try that, but I'm afraid mine may be a bit more complicated due to the amount of rules that my main character has....
  • CodeMonkeyCodeMonkey Head Chef, Member, PRO Posts: 1,803
    ≤ 0
  • quantumsheepquantumsheep Member Posts: 8,188
    \o/

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

  • butterbeanbutterbean Member Posts: 4,315
    http://img178.imageshack.us/img178/3920/picture1li.png

    So above is what rules I changed in the main player...

    Originally, under these new rules, it just said Otherwise: Destroy this actor

    In the "otherwise" section where she was destroyed, I changed it to checking 2 rules:

    Game.health to game.health-1

    Also, I put in change attribute: Self.linearvelocityY to 0 (when she pounces on enemies, her linear velocity Y goes up, and she moves upwards)

    So far, this hasn't worked, I'll have to look at the rules again

    When she collides with such enemy, she collides with that enemy, and they take either 1 or 2 healthbars away, and her linear velocity Y kicks in, and she starts floating upwards...

    I'll have to create an invincibility attribute as well, but how do get her to stop climbing up when she collides with the enemy...

    Oh dear.... Professor Layton... .might I inquire...?
  • butterbeanbutterbean Member Posts: 4,315
    Xacto, might I see a pic of your rules for invincibility?

    I'm having trouble with her collision with the enemy, even when the invincibility kicks in, sometimes the enemy takes 2 healthbars away from her with one hit.
  • xactoxacto Member Posts: 146
    Butterbean, here you go....

    http://farm3.static.flickr.com/2643/3897033852_fb137839ff_b.jpg

    --------------------------------
    StarFire
    http://gamesalad.com/game/play/8901
  • butterbeanbutterbean Member Posts: 4,315
    I see how you did yours, you respawn your ship once it's destroyed and health is above 0

    What I want to do, and not sure if this is possible is once she collides with such enemy, that the enemy won't strike her again until her invincibility wears off, but she's still on screen

    What happens is that the enemy hits her twice if not 3 times and she's destroyed even when "invincible"...

    Would I just have to follow what you did and respawn her? If so, how do I respawn her at the coordinate she left off at when the scene is 3000 width?

    Do you have a pic of your invincibility rule too? I followed the Wiki, and she blinks for me, but stays invisible...
  • butterbeanbutterbean Member Posts: 4,315
    It's strange, she still moves up when colliding with an enemy.... I'm trying to fix her linearvelocityY so it doesn't kick in when she collides with enemy, only when pouncing on him...

    She also still stays invisible, so how with invincibility do I make her go back to herself? I followed the Wiki carefully and looked it over, if you have rules for the invincibility tracking, let me know Xacto, thanks so much
  • xactoxacto Member Posts: 146
    The invisibility was the same for me, what I had to do is the following AFTER the player blinking:

    After 3.5 seconds
    change attribute: game.Invincible to 0
    change attribute: self.color.alpha to 1

    So it looks like I could not make the player visibility "on" and "off" consistent. (sometimes it worked, other times it did not) So I just placed a timer to make sure my player was visible at the right moment.

    http://farm3.static.flickr.com/2446/3896553103_a75dbc4f5e_o.png
  • butterbeanbutterbean Member Posts: 4,315
    She goes back to her normal state after the enemy hit her the first time, but the second time, she stays invisible....

    Did you put that as a separate rule, or under the same rule as invincibility?

    Now the only thing left to fix is when she pounces on an enemy, her linear velocity Y kicks in, and she moves upward after pouncing on him...

    Unfortunately, when she collides with him, she does the same... I'm trying to figure out how to turn that off when she collides with enemy head on, but she keeps floating upwards....
  • xactoxacto Member Posts: 146
    Hmm.....

    Maybe create a rule around the physics of the "player.movable" or the "player.density" attributes?
  • butterbeanbutterbean Member Posts: 4,315
    Also, she goes back to her normal state after enemy hits her once, but when she hits him a second time, she stays invisible....

    http://img169.imageshack.us/img169/2918/picture2ya.png

    There's a screenshot of the rules

    So 1st time she hits enemy, she blinks with invincibility then goes back to normal after 5 seconds

    Upon second collision with enemy, she'll blink again, but stay invisible....

    There are too many attributes and this is so confusing..... I'm giving up for today this is drivin' me crazy!
  • butterbeanbutterbean Member Posts: 4,315
    This silly, silly witch is not cooperating with me... :) That and my brain is mush after looking at code for hours... gotta' step away, get a bite to eat, take some fresh air in, and come back to it :)
  • butterbeanbutterbean Member Posts: 4,315
    Silly Witch is being good to me.. I finally fixed the problem :) (Glucose and oxygen are good for the brain....)

    Now moving onto the fun part, building levels!!
Sign In or Register to comment.