Overlapping rules?

HappyKat78HappyKat78 Member, BASIC Posts: 173
Hi Guys,

I've got multiple instances of soldiers with associated crosshairs. When an enemy walks over a crosshair his health depletes by 2 every 0.2 seconds the enemy is overlapping the crosshair. However, if two of the soldiers crosshairs are overlapping and the enemy walks over them both the enemy's health still depletes by 2 ever 0.2 seconds, but in this instance I want the enemy's health to decrease by 4 every 0.2 seconds (or 2 every 0.1 seconds) as he's getting shot at by two soldiers instead of one. The soldiers are spawned as instances so I can't set them up in advance as different actors. Does anyone know how I can get the enemy to react to multiple overlapping collisions as described above so his health depletes faster when being shot by multiple soldiers?

Many thanks!!!

Comments

  • ericzingelerericzingeler Member Posts: 334
    If the two cross hairs are overlapping, change a damage multiplier.
  • HappyKat78HappyKat78 Member, BASIC Posts: 173
    Thanks Eezing. However, these are all instances, so how will the enemy know that he's walked over a multiplier as the enemy is the one with the rules for reducing it's health? There could be more than two crosshairs overlapping and different instances of this going on. Thanks!
  • ericzingelerericzingeler Member Posts: 334
    Is there a max amount of crosshairs per enemy?
  • HappyKat78HappyKat78 Member, BASIC Posts: 173
    Technically no. Multiple actors can be spawned and all of their crosshairs could overlap although unlikely that they all would at the same time. Thoughts?
  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    If the two cross hairs are overlapping, change a damage multiplier.
    This is a great idea.
    how will the enemy know that he's walked over a multiplier
    How will the enemy know? He'll know because the crosshair actor will have a rule that says when actor collides with [crosshair] AND actor collides with [enemy] then Change Attribute game.multiplier to 2; Otherwise Change Attribute game.multiplier to 1.

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • HappyKat78HappyKat78 Member, BASIC Posts: 173
    Thanks for the comments tatiang. As there are multiple instances of this happening (multiple enemies and multiple crosshairs and there's not a fixed number of them) I can't use a game (global) attribute, I need to keep it to the instance. As it's the enemy's health that is being depleted then I'll need to have the enemy know when there is a multiplier is so the rule can be within the instance of the enemy. Hope that makes sense? Thanks again for your help/input!
  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    Oh right, you wouldn't want every enemy to have it's health depleted twice as fast. Gotcha. Hmm...

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    edited January 2013
    @HappyKat78 Well what about just a rule that says (same as above...) when actor collides with [crosshair] AND actor collides with [enemy] then timer every 0.2 seconds change attribute self.health to self.health=4; Otherwise timer every 0.2 seconds change attribute self.health to self.health=2?

    Edit: Nevermind... that won't work. :(

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • HappyKat78HappyKat78 Member, BASIC Posts: 173
    Thanks Tatiang. Well the actor who's health I need to change is the enemy, so not quite sure what you're suggesting above (although I appreciate the attempt). Looks like the simple answer is that the enemy won't react to every crosshair it is overlapping if there are multiple instances of the same one, so I'll have to think of modifying the design somewhat unless you have any further thoughts?
  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    Well, I always think better when I open up GameSalad Creator, so now I'm back after having done that. My solution isn't a spectacular one, but it may help you out.

    Basically, when two crosshairs overlap, they spawn a "double crosshair" actor (with self.alpha.color=0) that is only on the screen for 0.1 seconds. If the enemy collides with a crosshair, it turns pink (yep) and decreases health by 2 every 0.2 seconds. If the enemy collides with a double crosshair, it turns red and decreases health by 4 every 0.2 seconds.

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • HappyKat78HappyKat78 Member, BASIC Posts: 173
    This is very kind of you to build an example. Thanks for this. I'll play around with this concept and see if I can make the magic work by using this. Thanks very much!
Sign In or Register to comment.