Collide Question

bluebyu25bluebyu25 Member Posts: 500
edited November -1 in Working with GS (Mac)
I have two wall actors (right wall and left wall on either side of the screen) and both have moveable unchecked. My game is landscape orientation. I have a ball actor falling from the top of the screen with a collide behavior that says to bounce off of right/left wall when they collide.

The Problem: The effect I am trying to achieve is that when the ball collides with the walls, it bounces off in the other direction with the same movement speed it had before it collided. As of now, it just hugs whichever wall it collides with and dribbles down to the bottom of the screen.

Any help is much appreciated!!

Comments

  • UtopianGamesUtopianGames Member Posts: 5,692
    Use something like...overlaps or collides with wall change attribute self.Motion.Linear Velocity.X to -self.Motion.Linear Velocity.X

    Darren.

    image
  • bluebyu25bluebyu25 Member Posts: 500
    When I tried that, the ball just went through the screen to the other side for some reason. I have wrap X on but it should be hitting the walls therefore not going to the other side of the screen, not sure why it isnt now.
  • UtopianGamesUtopianGames Member Posts: 5,692
    Did you do the - (minus) at the start of the 2nd self.Motion.Linear Velocity?

    Darren.
  • bluebyu25bluebyu25 Member Posts: 500
    I guess its just a matter of how can I make an actor bounce more? Bc I already have the restitution at 2
  • bluebyu25bluebyu25 Member Posts: 500
    I will try that
  • bluebyu25bluebyu25 Member Posts: 500
    Still went through to the other side. Here is what I tried so you can see if I did it right according to your suggestion:

    Tap1 is the name of the ball actor by the way.

    Here is what I did:

    Create New Rule: Actor receives event>overlaps or collides with> with actor of type>right wall
    Ditto for the left wall.

    Then in the grey area where you drop behaviors I did:

    Change attribute: self>motion>linear>x TO -self>motion>linear>x

    Is "linear" the same thing as "linear velocity" bc all I have showing up after motion is: linear, angular velocity, max speed, and apply max speed.
  • bluebyu25bluebyu25 Member Posts: 500
    On tap1 I had "move" behavior and I changed it to "accelerate to" and it seems to bounce more now. Only problem is for some reason that "accelerate to" doesn't randomize its position as well as "move" does with my spawner.
Sign In or Register to comment.