How do I change the size of the collision box?

Ctrl 5Ctrl 5 Member Posts: 18
edited July 2014 in Working with GS (Mac)

In this game i am making, if the main actor is hit by a ball, then he loses. My problem is that the main actor's collision box is not the size i want it to be. It will collide with the main actor and trigger my 'lose' attributes, but it looks like it's not actually touching the ball even though it is. I want to balls to have to get closer to the main actor before triggering my 'lose' attribute, that way it looks like it's actually touching the ball. And i don't want the image size to change. How would this work?
Ps. I the balls collision shape is set at circle.

Thanks

Comments

  • colandercolander Member Posts: 1,610

    Constrain an invisible actor to the hero and use that for collision.

  • Ctrl 5Ctrl 5 Member Posts: 18

    Aha! I didn't think of that! Thanks colander!

  • SocksSocks London, UK.Member Posts: 12,822
    edited July 2014

    @MrAleksandr said:
    In this game i am making, if the main actor is hit by a ball, then he loses. My problem is that the main actor's collision box is not the size i want it to be. It will collide with the main actor and trigger my 'lose' attributes, but it looks like it's not actually touching the ball even though it is. I want to balls to have to get closer to the main actor before triggering my 'lose' attribute, that way it looks like it's actually touching the ball. And i don't want the image size to change. How would this work?
    Ps. I the balls collision shape is set at circle.

    Thanks

    You can do this in a number of ways, the most straightforward would be to constrain a smaller (invisible) actor to your main actor and use this to detect the collision (this doesn't have to be limited to one actor, if you wanted to construct a more complex collision shape you could use a few actors - all constrained to main actor).

    You could also use the magnitude function, this measures the distance between two objects, so you'd just use a rule that says if magnitude between the actor and the ball is less than - for instance - 30 pixels, then trigger the collision rule, as magnitude is measure from the centre point of an actor you could set up your collision point right in the middle of your actor (if magnitude is < 1 pixel) or you could even set up a collision point outside of the actor (think forcefield / shields for space ships !!).

Sign In or Register to comment.