How can i set a 'hit marker'

rickynikorickyniko Member Posts: 85
edited November -1 in Working with GS (Mac)
hello,
im currently making a platformer game, and i want something similar to supermario,
as in, i want the 'actor two' to die if 'actor one' jumps on its head, but i want 'actor one' to die if actor 2 walks in to actor one.

so basically i want a hit marker on actor two's head,

any ideas?

Comments

  • firemaplegamesfiremaplegames Member Posts: 3,211
    You need to do that with logic. By using Rules in the Enemy Actor.

    In English, the enemy would say" If I collide with the Player, kill the Player - unless the Player is on top of me. In that case, kill me."

    Written out with Rules, it would look like this:

    Rule
    When all conditions are valid:
    Actor overlaps or collides with Actor of type Player
    -----Rule
    -----When all conditions are valid:
    -----game.PlayerY > self.Position.Y
    ----------[kill me]
    -----otherwise
    ----------[kill Player]
  • millerbrother1millerbrother1 Member Posts: 108
    Great logic, except I'm not clear as to how you would say [kill Player]. As far as I know the "Destroy Actor" behavior is only good for the current actor (i.e. the enemy). So to put that in the otherwise statement baffles me a bit. Did I miss something?
  • firemaplegamesfiremaplegames Member Posts: 3,211
    I put that in quotes just because I'm not sure what happens when the player dies. Maybe there's sound effects, death animations, etc.?

    The easiest way would be to create a global boolean attribute called something like 'pleaseKillPlayerNow'.

    When the enemy hits the player, change game.pleaseKillPlayerNow to true.

    In the Player, have a Rule that listens for that, like this:

    Rule
    When all conditions are valid:
    game.pleaseKillPlayerNow = true
    -----Change Attribute: game.pleaseKillPlayerNow to: false
    -----Destroy Actor
  • millerbrother1millerbrother1 Member Posts: 108
    Just curious, how could we adapt this logic to work with a set of inanimate actors? For example: Angry Birds. A pile of blocks fall onto the enemy. If the blocks hit the enemy on the head, it decreases it either kills or weakens him. But if it any block hits the enemy and it is not on its head, then it doesn't do anything to destroy or weaken him. (i.e. an enemy can be perched atop a block and still be safe)
  • millerbrother1millerbrother1 Member Posts: 108
    Jstrahan, I'll continue the conversation on that forum. Thanks!
Sign In or Register to comment.