Attacking Hitbox

Hello. I was wondering if anyone could tell me how to make a hit box when my character does its attack animation. I have figured out how to make constrained hit boxes to the characters, but I have not figured out how to make a hit box that only works when my character attacks. Do I constrain the hit box to the attack button? I've been unsuccessful trying to figure it out on my own.

Comments

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949

    It would help if you provided a screenshot of what your game looks like. From your description, I can't tell if you are constraining a weapon/limb to your character or something else. By "constrain the hit box to the attack button" do you mean associate them or actually constrain their positions to each other?

    Here's my best guess based on the idea of association: you can make a boolean that changes to true when your character attacks (and false when it doesn't) and then have the hit box actor be active only when that boolean is true.

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

  • TinyTimidTurtleTinyTimidTurtle Member Posts: 15

    Hi, that's exactly what I meant. The character has a weapon that she swings and I want to have a hit box appear when the animation is seen. I'll try to figure it out with what you gave me. thanks!

  • TinyTimidTurtleTinyTimidTurtle Member Posts: 15

    So I tried to figure out how to constrain a character to a boolean and I'm having difficulty. Do I pick position or size? Also do I fix the new Hit Box attack actor to the border of my main actor who is attacking?

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    edited December 2014

    You can't "constrain a character to a boolean." If you constrain something in GameSalad, it means to keep one value always the same as another value. So if you constrain self.position.X to 50, then the x position of the actor will never stray from 50. Since a boolean is either true or false, you could only constrain another boolean attribute to it. But regardless, that's why I made the distinction about association. A boolean is often used as an indicator that something is occurring. I'm not the best person to help you with constraining a weapon during a swing motion but as far as the boolean goes, that would allow you to know when the character attacks and then do... something when that is happening.

    You might find @Socks' Link Machine to be helpful.

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

  • TinyTimidTurtleTinyTimidTurtle Member Posts: 15

    Ah I see. So if I were to pick a specific thing for the boolean what would that be? I am not having success with using positions or sizes for the booleans. Is there a way I can link a collision command with a boolean?

    Right now I have my hit box attack actor linked to the front section of my player actor. I also have the enemy have a destroy on collision command when it interacts with the attack actor. This works great, but it's always constant. I'm having trouble turning the interaction on and off with the boolean. I have tried using positions and size of the attack hit box actor with the boolean. So, attack actor's x position/size is true when D (attack button) is pressed and false when it is not. But that does not remove the attack hit box actor at all. What should I make the boolean equal?

    Also, thank you for the link. Using trig in programming is still far beyond me at them moment.

Sign In or Register to comment.