Collision stopped working........Help needed....

luke2125luke2125 Member, PRO Posts: 225
edited May 2012 in Working with GS (Mac)
Hi,

I was working on Level 8 of my game, and suddenly collision is not working. I have a main actor that I have set up seven conditions in 1 rule, like ( When Any conditions are valid, Actor receives event, overlaps or collides with actor type, alienship1, and so on......) In some levels, like level 8, I call it Challenge Time, one enemy against main actor. However, on this challenge level, the collision has stopped working. Any tips or is this a bug? Would appreciate any help regarding this...Thanks and God Bless....

Also, how can I copy and paste the code on the forum, so people can see the code?

Best Answer

  • MotherHooseMotherHoose Posts: 2,456
    Accepted Answer
    well… I would have one rule for the collide with the tag ship
    then the other rules with names in that main rule's behavior area

    but, in any programming, something that works well … is what you use

    if the behaviors for the the collision are the same …
    then one rule using tag and just those behaviors

    Example:
    all the ships are are affected by the bullets but each need different number of hits to destroy them
    on the ship … add attribute myHits … index Type … and type in the number for each

    Rule: when
    Event: overlaps or collides with actor with name bullet
    --changeAttribute: self.myHits To: self.myHits-1
    another Rule: when
    Attribute: self.myHits = 0
    -Destroy

    ==
    if their behaviors are different … then you need separate rules and use name

    image MH

Answers

  • MotherHooseMotherHoose Member Posts: 2,456
    7 any conditions in 1 rule … a lot of checking for validity of any condition!

    may be smoother to nest separate rules for dependent conditions
    and add tags in Home > Actors [+] new tag … collider or ship

    Rule: when (All)
    Event: overlaps or collides with the tag collider
    --Rule: when overlaps or collides with alienship1
    ---do this
    --Rule: when overlaps or collides with alienship2
    ---do that
    etc.

    then the computer can ignore the other rules … until the 1st event is valid

    image MH
  • MotherHooseMotherHoose Member Posts: 2,456
    7 any conditions in 1 rule … a lot of checking for validity of any condition!

    may be smoother to nest separate rules for dependent conditions
    and add tags in Home > Actors [+] new tag … collider or ship or whatever name you like

    Rule: when (All)
    Event: overlaps or collides with the tag collider
    --Rule: when overlaps or collides with alienship1
    ---do this
    --Rule: when overlaps or collides with alienship2
    ---do that
    etc.

    then the computer can ignore the other rules … until the 1st event is valid

    @};- MH
  • luke2125luke2125 Member, PRO Posts: 225
    Hi Motherhoose,

    Thanks for the quick reply, really appreciated it....Yes, understood, so in other words, just seperate those conditions into 7 rules, instead of having like I have:

    Rule: when (Any)
    Event: overlaps or collides with the tag collider
    --Rule: when overlaps or collides with alienship1

    Event: overlaps or collides with the tag collider
    --Rule: when overlaps or collides with alienship2

    I have another question, should I use the name of the object or Tag, is there any difference, which one is better.......? Thanks again and God Bless.....

    Sincerely,

    Sunday
  • luke2125luke2125 Member, PRO Posts: 225
    Hi MotherHoose,

    Thanks for the explanation and tips, really appreciated....God Bless....

    Sincerely,

    Sunday
Sign In or Register to comment.