1. Hey! Guest! The 35th GMC Jam will take place between November 28th, 12:00 UTC - December 2nd, 12:00 UTC. Why not join in! Click here to find out more!
    Dismiss Notice

2D blood decal

Discussion in 'Programming' started by jcyuan, Nov 9, 2019 at 5:55 AM.

  1. jcyuan

    jcyuan Member

    Joined:
    Saturday
    Posts:
    2
    I'm finding clues on how to make blood decal dynamically, like
    [​IMG]
    this.
    Katana ZONE, which is I think made by GMS.

    Anyone here know something about this? thanks!
     
  2. Nocturne

    Nocturne Friendly Tyrant Forum Staff Admin

    Joined:
    Apr 13, 2016
    Posts:
    6,960
    Hello! Okay, the best and easiest way to do this with a surface... basically you create an instance for the blood while it's moving and then when it stops moving you destroy it and draw it to a surface. The surface is then drawn to the screen and gives the illusion of a permanent decal.

    This is actually pretty easy to do, however it has a few downsides... The first one is that if the room is very large then you need to use a large surface which might not be viable for memory reasons, which means you'll need to tile the surfaces. You also have the risk that the surface data will be wiped if the game window is moved or minimised or goes from fullscreen to windowed or vice versa. This can be avoided by making a sprite from the surface every few steps and drawing that instead of the surface though (so, instance to surface, surface to sprite, draw the sprite).

    If it's any help, I actually have a marketplace asset that does this for you and is pretty much bullet-proof: https://marketplace.yoyogames.com/assets/8563/infinite-debris
     
    jcyuan likes this.
  3. jcyuan

    jcyuan Member

    Joined:
    Saturday
    Posts:
    2
    so nice!!! really helpful, I'll look into your assets, thanks so much.
     
    Nocturne likes this.

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