How to do smaller collision volume vs image size?
Threepwood
Member Posts: 30
What if you have a character that's wide when they shoot (say 200 pixels), but you still want their collision volume to be something like 64 wide? If you set it to 64 wide in the actor then the image clips when you place it in the scene and there are rendering issues. I have to use fixed vs tile or stretch.
Is it possible to have a separate collision volume or dimensions for an actor that's not tied to the dimensions of its art?
Is it possible to have a separate collision volume or dimensions for an actor that's not tied to the dimensions of its art?
Comments
create an invisible actor with alpha set as 0 at size 64 wide, then constrain it's x and y position to your original actor. Then set the colision rules with the invisible actor and not the main one.
Rule: When Touch is Inside
.....Rule: When Touch is Pressed
..... .....Rule: When Touch is <= [x max] and >= [x min] and <= [y max] and >= [y min]
..... ..... ..... [ do something ]
You can add more than 1 rectangle zone on an actor if you wish by adding additional rules.
BTW:
This only works for tap zones (like a button) and not for collisions. For collisions...The other solutions work best.
The distance/magnitude would work well but it's a shame to have to do such a thing. Most engines have the concept of the base art, then a bounding box that can be any arbitrary size, to collide with that actor. Would be two more simple properties GameSalad should add to actor attributes.
If you're making a Zombieville style game you may well want the collision with your character to be 128x64 but the art may stick out further past 64 wide and you don't want an enemy colliding until he hits the "meat" and not just the tip of a long rifle or whatever.
an invisible actor of the size you want, constrained would work as well. Guess it's just one more actor. At least in that scenario you can still use the collide logic built into GS and not have to have your own.