Colliding using x and y coordinates?

DimensionGamesDimensionGames PRO Posts: 993
edited November -1 in Working with GS (Mac)
Hey all, the title says it all I am wondering can you do that? Im using an actor which is constrained to the mouse and cannot go off the screen using the min and max behaviours to prevent the need for actors on the edge of the screen to do that job but am concerned I will have to do just that so that other actors can bounce against the sides.

Any help is much appreciated.

Cheers.

Comments

  • JohnPapiomitisJohnPapiomitis Member Posts: 6,256
    you can do something like when self position x is greater then or equal to 470, change motion linear x to -(motion linear x)

    that will make it collide backwords. You can also give change velocity it a random direction betwwen the values that would be going backwards, to give it an angular bounce.
  • DimensionGamesDimensionGames PRO Posts: 993
    So the first one just makes it go back to its origin and the second one would make it a realistic angular bounce if I am correct?

    Cheers.
  • JohnPapiomitisJohnPapiomitis Member Posts: 6,256
    the first one will make it bounce straight back in the direction it came from.

    Now if you wanted it to collide with the right of the screen you could do:

    When self position x is greater then or equal to 470

    change velocity to random (110,245) relative to scene. That will make it boucne back more with and angle
  • gurechangurechan Member, PRO Posts: 211
    There's a template for this. Search for: collision angle in GS creator
  • DimensionGamesDimensionGames PRO Posts: 993
    Thanks John, been trying to work on more of the maths side of GS and this helps :) @ gurechan, thanks so that shows you the angle of incidence and so I would set it to reflect using the same angles (angle of incidence = angle of reflection).

    Cheers.
Sign In or Register to comment.