Collision Mask

This forum is currently in read-only mode.
  • Could someone explain to me how the collision masks work? Can they be used for animated player sprites? I've watched David's YouTube video showing them being used for a platform, but I'm not sure how to implement them for an animated sprite.

    Also, it seems that whenever I update the collision mask it reverts to the bounding box size after importing it. I don't know what I'm doing wrong

    Also, is the "Copy collision mask to each frame" feature supposed to copy the collision mask to all the frames for all the animations in the sprite, or just the currently selected animation? The dialogue says "in the animation package," but I'm not entirely sure what that means.

    And if anyone has a sample .cap with the collision mask feature being used on a player sprite I'd be much obliged

  • I think someone else was having problems with animated sprites and the collision mask. I think the conclusion was to not do it for animated objects.

    I could be wrong though.

  • I think it copies one collision mask for a whole animation.


  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Hrm... anyone have a more authoritative answer on the subject?

  • For each frame of the animation there is a mask frame.

    Show just do what David did in his video for each frame and it will work.

    doing this is really good for oddly shape frames that changes height or width in an animation.

    And yes, "Copy collision mask to each frame" will add the collision mask to

    all the frames in that animation set "not all the animations". so pick the mask frame you want for this. this is good for animation where the frames shape don't change from frame to frame and is centered.

  • Grumph. Sounds like a pain in the butt. I'll just stick with using dummy objects for player sprite collision...

  • Grumph. Sounds like a pain in the butt. I'll just stick with using dummy objects for player sprite collision...

    It is actually a is not a pain.

    It will save more time them doing dummy objects.

    With that being said it would be nice to be able to open the mask in the picture editor and change the mask that way.

  • It is actually a is not a pain.

    It will save more time them doing dummy objects.

    Okay then... I must once again be misunderstanding. What it sounds like you're saying is that:

    1: I must "Copy the collision mask" for each animation of the sprite, rather than just once for the entire sprite and

    2: It won't work properly unless all of the hotspots are centered and all of the frames are the same width

    ... but yet you say it would be easier and save more time. When I make a dummy object, I just draw a box and make one event that says "Always -> Set sprite position and angle to box" and it's done. I don't see how repeatedly setting the mask for each animation will save more time, and if it won't work with varying width of frames anyway then what's the point?

    Ugh. I am as confused as ever. Does it work, or not? Can someone make an example .cap?

  • I've set up a sprite with a few animations and put Platform behavior on it already. The animation tags are set, and it's ready to go. All it needs is the collision mask so the sprite doesn't freak out:

    Here's what I'm doing, step by step:

    1. I select the Mega Man sprite.

    2. I click the "Angle 0 (Right)" angle in the "blueStand" animation in the Animator tab.

    3. I right-click the frame in the lower portion of the Animator, and select "Launch explorer."

    4. I use Photoshop to open the mask png that appears in the folder. I draw a box, I save the file.

    5. I click OK on the dialogue to import the images to Construct.

    6. I click YES to import the mask.

    7. I right-click the frame in the lower portion of the Animator and select "Copy collision mask to each frame."

    When I run the game, it's like nothing has changed at all. When I check the masks for the sprite frames, there's nothing there, even for the first standing frame I changed. It's like I'm not accomplishing anything at all.

    So am I doing it wrong, or is it broke? And if someone can show me how to fix it, I'd be much obliged

    please for the love of god

  • Bumping this because i am also having difficulties with the new collision mask thing.

    For me, when i try right clicking and then selecting "launch explorer", a window pops up that just has a text file labelled "stub". No image files at all. And i just downloaded the latest version of Construct yesterday.

  • I just did some experimenting with it, and it does work... you just have to edit the mask for each frame individually. The bug lies in the fact that it appears the masks reset themselves if you do the "Launch Explorer" thing again, and the "Copy collision mask to each frame" feature doesn't appear to work.

    So yeah, you could use this to make hitboxes for your player or enemy sprites, but it would take a lot of work and be quite tedious, at least until it's fixed. So until then I guess it's separate hitboxes.

    I don't know what's happening with yours, though. I get the "Stub" file too, but I also get the sprite.png, mask.png, and frames.txt. Sounds like a different issue entirely.

  • Weird. Guess i'll just wait for the fix i suppose.

    Hey, what's with the Collision Mask button in the sprite editor and why doesn't it do anything? Or does it do something, i just don't know what to do with it?

  • It's an incomplete feature.

  • It's an incomplete feature.

    In 99.7 you can now do collision mask in the picture editor.

    It works great, but the right clicking feature is still incomplete.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)