Actors impact

mozoomozoo Member Posts: 19
edited June 2012 in Working with GS (Mac)
Hi I need some help with the collision between same actor.

I have one actor that's a circle. This actor spawn in the scene with different directions. The problem is that when they collide without drag them, I need to know wich is the angle of collision. I know how to make with different actors, but I don't know how to do with same actor.


Best Answers

  • jckmcgrawjckmcgraw Posts: 647
    Accepted Answer
    @mozoo, when you want somebody to take a look at what you just wrote, but an @ in front of their username like I did to yours. Then they'll get an email notification (probably), and help you out some more :)
  • MotherHooseMotherHoose Posts: 2,456
    Accepted Answer
    @mozoo

    in the demo …
    the circles collide and changeAttributes for the game collide positions
    have the circle spawn the union animation
    when animation is complete … have unionAnimation spawn the circle2

    @jckmcgraw … great tip!

    image MH
  • RThurmanRThurman Posts: 2,881
    Accepted Answer
    Does this demo get close to what you want to do? (Sometimes its faster to create a demo then to try to write down the steps.)
    http://www.mediafire.com/download.php?dg005cq4v2jtfb5

Answers

  • lo_klo_k Member Posts: 23
    Hi @mozoo
    I'm sorry, but I don't understand your question entirely. Could you maybe explain your problem again?
  • MotherHooseMotherHoose Member Posts: 2,456
    how many circles are spawning? … how many will be onScreen at one time?

    try:
    add a gameAttribute … index type … name: spawnCount

    in the spawnerActor:
    before the spawn
    … add behavior … changeAttribute: game.spawnCount To: game.spawnCount+1
    -do spawn

    depending on how many circleActors onScreen
    you will need for each … gameAttributes
    collide#X
    collide#Y
    and 1 attribute for impactAngle

    on circleActor:
    1st behavior: changeAttribute: self.Name To: game.spawnCount
    Rule: when
    Event: overlaps or collides with actor of the type circleActor
    -Rule: when
    -Attribute: self.Name is 1
    ---changeAttribute: collide1X To: self.Position.X
    ---changeAttribute: collide1Y To: self.Position.Y
    -Otherwise:
    --Rule: when
    --Attribute: self.Name is 2
    ---changeAttribute: collide2X To: self.Position.X
    ---changeAttribute: collide2Y To: self.Position.Y
    etc.

    changeAttribute: game.impactAngle To: vectorToAngle(x,y)

    ==
    it might be easier to recycle the circleActors
    and, also … store the collide values in a Table … and use for vectorToAngle

    I tried this with 2 circleActors … worked just fine

    image MH
  • mozoomozoo Member Posts: 19
    Hi,

    The number of circle actors is uncertain, because they appear and you can drag them so it's not possible to know the exactly number.

    I will try it and i will see what happens!

    Thx
  • mozoomozoo Member Posts: 19
    I will try to explain myself better. I have two actors: 1levelcircle and 2levelcircle. In the scene every 1 second appear 1levelcircle and each time with different direction and from differents points of the scene. If you join 1levelcircle and appear a 2levelcircle. In the game you can obtain a 2levelcircle by dragging 1levelcircle and colliding with other 1levelcircle or by random because they collide.

    The number of 1levelcircle is uncertain.

    I achieved to find the angle of collision when I drag one of the 1levelcircle and collide with another one. The problem is when 1levelcircle collide random. I don't know how to find the (x, y) position of the two 1levelcircles.

    Thx
  • MotherHooseMotherHoose Member Posts: 2,456
    and, you need the X,Y positions … for the spawn of circle2 position?

    well got it to work with 8 circle1 actors …
    IMO … angle of impact is not needed … angle is created by the X,Y position of collidingActors

    demo: http://www.mediafire.com/?0vphb2stvxrf1h6

    hope this helps

    image MH
  • mozoomozoo Member Posts: 19
    Hi MotherHoose!

    In the game when two "1circles" collide, spawn a new actor "union". When the actor "union" is destroyed appears the actor "2circles". The problem is that "union" actor is a animation of how two "1circles" are fusioning. The problem is that I need to find this angle to rotate de animation according to the collision point.

    I dont know how to find the (x,y) position of this two circles when they collide random. The number of 1circle actor is uncertain because during the game they appear from diferents points and with different directions.

    Thx
  • mozoomozoo Member Posts: 19
    @MotherHoose and @RThurman

    Thank you guys! now I can continue :)
Sign In or Register to comment.