How can you make an actor disappear on collision?

legodude2222

  • Posts: 105
I have the health behavior for my player setting the default damage of any collision to 1. I was wondering if there was a way to make another actor like a heart or something that disappears on collision without doing default damage to my player
Making games, one error at a time.

BlightXP

  • Posts: 121
yup :)

make a number attribute for your health(heart)
on collision decrement it by 1
abcdefghijklmnoyqrstuv-WXP&Z ;D

legodude2222

  • Posts: 105
So i make a number attribute that decreases by 1 for both the health behavior and heart and that will stop the heart from doing default damage to my player but still make it die on collision?
Making games, one error at a time.

Tuo

  • *
  • Posts: 2469
Um, I think he was asking about showing hearts for how much health is left. If so, your best bet is to throw out the pre-made behavior and make your own. Use an attribute (i.e. "Health") to store the HP of the player and then when the player gets hit, change the attribute, delete the old HP signs and re-create them. It's not the most efficient, but it's the simplest way to do it that I know (see the picture). If your screen moves, you may need to add the x/y of camera to the x/y creation location for the circles (or hearts or whatever).
Don't look to me but rather to the One who is the reason for what I do. :)

If you need help, send me a PM. Even if I haven't been on in the forums in ages, I still receive those messages via email notifications. You can also reply to any of my forum posts, regardless of the age (especially if I created it), and I will likely reply.

If you want to see the programming behind certain types of games, feel free to check out my "Demo-" games on StencylForge (http://community.stencyl.com/index.php/topic,16160.0.html)

legodude2222

  • Posts: 105
I actually only need one custom block out of that picture. I realized that i can still use the health behavior, but i'll create a new event stating that if self hits a heart kill heart and decrease health by by 0. Just so u understand, the heart actor is meant to be put in the game so that when my player collides with it, it heals the player. I already have a health regenerate behavior that goes with the health behavior, so i just needed the heart to disappear after colliding with the player without damaging it. I just have one question: where specifically did u find the if self hits a ____ block? Is it one of the starting code blocks for an event, or is it in one of the tabs like actors, attributes, scenes, etc. ?
Making games, one error at a time.

BlightXP

  • Posts: 121
It's a starting code block under collision ^^
just use the kill last collided actor.
abcdefghijklmnoyqrstuv-WXP&Z ;D

legodude2222

  • Posts: 105
Making games, one error at a time.