Enemy hit detection problems!!

nihatozmerdnihatozmerd Member Posts: 14
edited November -1 in Working with GS (Mac)
Hi all,

I have make a actor and a enemy that spawn randomly. I can kill the enemy when the actor overlaps the enemy and i press space. but i have a problem now! If two enemy's spawn near each other and the other one is infront of the other enemy. When i move the actor over the enemy actor it kills the actor behind him aswel, Thats a problem.

So what i want is that the actor only kills the enemy in front of the other enemy first!

My English is not that perfect, so i hope you guys understand.

Comments

  • UtopianGamesUtopianGames Member Posts: 5,692
    You will need a game boolean for the 2 actors that can be destroyed.

    Lets call the boolean CanDestroy..now in the actor that is underneath do a rule if overlaps or collides with the actor on top change CanDestroy to false in the otherwise part of the rule change attribute CanDestroy to false.

    Now when you press space bar check that CanDestroy is true.

    Hope this helps.

    Darren.

    DeepBlueApps over 10 million hits and home of:
    GS Tools
    Templates
    Video Tutorials
    Forum
    3rd party marketplace
  • nihatozmerdnihatozmerd Member Posts: 14
    What i understood of this is:

    I made a game boolean CanDestroy. In the enemy i made a rule that when overlaps and collides with the same enemy change CanDestoy to False in the otherwise part i did the same thing.

    and i made a rule and change att. in the actor that when overlaps or collides with enemy change CanDestroy to true.

    But it still not working!!! It still kills both enemys the one infront and the back.
    I dont know what im doing wrong!
    PLZZ help! Im stuck!!
  • UtopianGamesUtopianGames Member Posts: 5,692
    www.utopiangames.co.uk/misc/killone.zip

    Made a quick demo for you, hope it helps.

    Darren.

    DeepBlueApps over 10 million hits and home of:
    GS Tools
    Templates
    Video Tutorials
    Forum
    3rd party marketplace
  • nihatozmerdnihatozmerd Member Posts: 14
    Utopian,

    this is kind of what i mean, but instead of 2 enemy actors i have one actor!
    and i would like to keep it that way.
    How can i apply the same thing to one actor.

    So if the same enemy actor overlaps the other same enemy actor, kill the actor infront of him first!

    *The way how i kill a enemy is. a made a integer att. in the enemy actor called enemy life. So when actor overlaps enemy en space is pressed change enemy life -1. and i made a rule when enemy life is 0 destroy actor.
  • UtopianGamesUtopianGames Member Posts: 5,692
    Umm not sure tbh how you would do it with a single actor or if it's even possible, if i get any spare time soon i will look deeper into it for you.

    Darren.
  • nihatozmerdnihatozmerd Member Posts: 14
    Utopian,

    Thanks for your all help! Can u help me with another problem that im having!

    The enemy actor that i have grows from size +10 every 0.5 sec. and i just made another, but this one grows in size +15 every 0.5 sec.
    What i want is that when the same enemys overlap eachother, that the biggst enemy in size get infront of the enemy that is smaller in size.
Sign In or Register to comment.