GMS 2 Check collision with 2nd Frames Collision Mask of sprite?

Discussion in 'Programming' started by MilesThatch, Mar 13, 2019 at 5:59 AM.

  1. MilesThatch

    MilesThatch Member

    Joined:
    Jul 12, 2016
    Posts:
    385
    Title pretty much covers. Can you avoid creating a 2nd sprite to check collisions with by having a single sprite with frame 0 being the core sprite and frame 1 being the custom collision mask? Precise mask.

    Thanks.
     
  2. TheouAegis

    TheouAegis Member

    Joined:
    Jul 3, 2016
    Posts:
    6,236
    Wouldn't make too much difference memory-wise.
     
    Alexander James likes this.
  3. Alexander James

    Alexander James Member

    Joined:
    Mar 24, 2017
    Posts:
    3
    No, you can't. It doesn't really make a difference. Even if you can, the memory used is still going to be roughly the same.
     
  4. MilesThatch

    MilesThatch Member

    Joined:
    Jul 12, 2016
    Posts:
    385
    Nothing to do with memory used or trying to save on memory. It's more about convenience and not having to rely on multiple stacked objects with different collision masks for checking different things. So if you have a player in an isometric 2D game I can see 3 if not 4 collision masks involved.

    1) The base of the player mask, a small rectangle, would be used to check for collisions and make sure the player is still within the map,
    2) a collision mask that containing the swiping passage of a sword attack that would be used for collision checking on attacks. This one would exclude the player sprite pixels
    3) this one is the positive of the sword, a player body only mask for checking collision on receiving damage.


    Shame there isn't a function like that. I have to stack a player, player_sword and player_masks objects on top of one another
     
    Last edited: Mar 14, 2019 at 6:13 PM
  5. TheouAegis

    TheouAegis Member

    Joined:
    Jul 3, 2016
    Posts:
    6,236
    If it's isometric, your masks should be diamonds, not rectangles.
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice