Masking Effect

Hey guys does anybody know how to hide a read square behind a heart or mask it? I want to make it that when my actor gets hit the red will drop looking as if the heart is less full. Does anybody know how to do this?

Comments

  • DeadlySeriousMediaDeadlySeriousMedia ArizonaMember Posts: 838
    Place a graphic with a blank area where the heart should be. Place the red actor behind. Have the height interpolate according to the hit points to have it shrink. That should do it. You may also have to interpolate the position too because the height scales from the center.
  • TimeTime Member Posts: 113
    I want the red to be exactly the shape of the heart though.
  • DeadlySeriousMediaDeadlySeriousMedia ArizonaMember Posts: 838
    edited November 2012
    Hmm, that's the only way I can think of. the red would look like the snap of the heart because of the heart shaped hole in the mask actor, but that's about as tricky as I get with GS. :) Unless you make multiple heart images with each image having more and more cut off, then when damage occurs you can change the image out, or have a health integer attribute, each number tied to a heart image, then interpolate the health down on hit and the heart should look like it's shrinking. Maybe. Worth a shot.
  • famekraftsfamekrafts Member, BASIC Posts: 834
    Make a heart shape cutout on a square bg which matches your background so it blends well, now keep a square of red potion or hp behind that actor, people will be only able to see the heart shape and not the sides.
  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    edited November 2012
    Here you go:

    (To make the heart image, I took a standard heart shape outline and selected the inside with the magic wand tool in PS and then did an inverse select and filled the selection with white. This allows you to use the color selections in GS to match the background color, although I've unlocked the heart actor in order to access the scene background color values.)

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    edited November 2012

    Hi @MovingStudios

    And here's a couple of other ways, similar to the description by @DeadlySeriousMedia - might help you out.

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

  • TimeTime Member Posts: 113
    You guys are all amazing! Thank you so much for taking the time out of your day to do this! One more question though, do I have to use a background behind the heart or is there anyway to just use a heart? Thank you for the templates: @gyroscope, @tatiang and thank you for the suggestions @DeadlySeriousMedia and @wickedsunny!
  • TesseractEngineTesseractEngine Member Posts: 180
    @gyroscope's solution is really neat! Give that man an Awesome click. :)

    If you really need a heart without a background, as gyro has so ably shown you, MovingStudios, you could draw each successive frame as a separate graphic in your preferred graphics app and swap those out at each hit event.
  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    edited November 2012

    Thanks for the "Awesome" @TesseractEngine , appreciated!
    One more question though, do I have to use a background behind the heart or is there anyway to just use a heart?
    So another way would be as per @TesseractEngine 's suggestion, i.e use image frames which change with your integer;

    Or, based on the top version in my test file, cut out your heart shape in your background exactly where you want it, so you've basically got your background with a heart-shaped transparent hole in it; save as png with transparency and bring in the background to your game. Now place the red block actor behind the background. :-)

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

Sign In or Register to comment.