collision end?

jmp909jmp909 Member Posts: 73
edited November -1 in Working with GS (Mac)
is it possible to determine when a collision ends? eg

if actor collides with actor of type alien, add 1 to actor "touchcount" attribute
else subtract 1 from actor "touchcount" attribute

so say if my actor collides with 2 aliens at the same time, the score will be 2 but when one of the aliens bounces off , the score will be 1 (only 1 alien still touching)

thanks
j

there's probably another way round this, but i can't work out how

Comments

  • jmp909jmp909 Member Posts: 73
  • jmp909jmp909 Member Posts: 73
    if we could have a feature to reference the object that an actor collides with then I think we could easily make match3 games...

    eg if actor collides with actor of type alien and CollidedActor.touchCount>=2.... then destroy this actor (for match3, i believe an item just needs to touch another actor that is touching 2 others...(or rather 1 other, other than itself and the collided actor)

    if ABC are touching and D is added to make ABCD then C's touchcount is only actually 1 at this point (touches B).. it only becomes 2 when D is added, so D would have to be able to reference C as suggested above to add to D's touchcount first... this might also be affected by the order in which the rules run i guess

    looking at the forums presumably other people have tried this and it's not possible with the current version of GS?

    thanks
    j
  • firemaplegamesfiremaplegames Member Posts: 3,211
    Well, a match 3 game usually uses arrays to tell you what blocks are next to other blocks. You don't actually use collision.

    In GS, you COULD use collisions, but then you'd have let's say 100 (10x10 grid) actors all testing for collisions.

    100 actors doing collision checks all the time would kill performance.

    CodeMonkey has a test of SameGame working under his profile. But that would really difficult to try to make work for a iPhone 3G.

    Until GS gets something like a 2D array, grid-based puzzle games are going to be really difficult to make.
  • jmp909jmp909 Member Posts: 73
    it's not using a grid though it's physics based... i've done it in flash but it needs arrays and actor-actor communication
Sign In or Register to comment.