Hit Box

Greenkirby21Greenkirby21 Member Posts: 32
edited November -1 in Working with GS (Mac)
When I made my image in photoshop, it was 50x50 pixels(the canvas). However, the actual space I used for my actor was about 3/5 of that, around 30x30. So, when my actor collides, it doesn't actually look like it collides because it is hitting the "clear" pixels from the canvas. No matter what I try however, the 50x50 space still exists in my actor. Does this have to do with the actor bug? I resized the image by cropping the canvas to 30x30, and so the image is now flush with the clear canvas background. However, the actor still shows it has a 50x50 canvas even if I remove/add the new image, change the size under actor attributes, everything.

Is there a quicker way, I really don't want to spend forever remaking the actor >_>. The game is almost done and I would need to do it for all my levels!

I read about making a colliding box in my actor, would that work? How exactly do I do that xD!

thanks : )

Comments

  • quantumsheepquantumsheep Member Posts: 8,188
    Make two new global variables:
    PlayerPositionX
    PlayerPositionY

    On your main actor, constrain PlayerPositionX to self.positionX and PlayerPositionY to self.positionY

    Then make a smaller actor called 'Hit Box'.

    In that, Constrain its self.positionX to Player PositionX and its self.positionY to PlayerPositionY

    This way, your hit box will follow your main actor.

    If you make your hitbox smaller than your actor (and make its colour opacity 0) you'll have a smaller hit area that isn't visible but will follow your actor around.

    Hope that helps!

    QS :D

    Dr. Sam Beckett never returned home...
    Twitter: https://twitter.com/Quantum_Sheep
    Web: https://quantumsheep.itch.io

  • Greenkirby21Greenkirby21 Member Posts: 32
    ok great thanks a lot :)
  • tenrdrmertenrdrmer Member, Sous Chef, Senior Sous-Chef Posts: 9,934
    Just to clarify though it doesn't sound like you actually changed the image in the actor. since if you did in fact crop the transparent part of the image out and import it correctly to your actor the collision should be in drectly on the image. GS wont add to your image.
  • Greenkirby21Greenkirby21 Member Posts: 32
    how do you do it properly, here is what I did

    made the new image, image1.png
    deleted old image1.png from images section
    hit plus button added new image1.png
    dragged new image1.png on top of the actor from the actor pane.

    the image changed, but if you click on the actor and look at size, it still says 50x50, insteawd of 30x30 and the image is stretched
Sign In or Register to comment.