Touch is pressed then turn to false

Hello! I've been having a huge problem with my melee close combat game for like at least a week or 2.

I've come up with another idea of in fact I like this idea more because it makes my game harder, which i'm aiming for but I need your guys help on this one.

Basically I have my attack button. When I press it I only want it to be true for like 1 second or half that, then it turns to false so you have to click it again.

Here's a better example, think about it like your playing call of duty & you have an M9 or Desert Eagle when you press the button to fire the hand gun it only fires once then you have to press the button to fire it again. THAT'S EXACTLY WHAT I'M LOOKING FOR!! I can't figure out how to do that for my life. I know it involves Booleans but I just don't know how to make everything come together. (I will would like it only to work when you are close to with the enemy if that's possible. Other wise if your not "in the enemy's face" per the attack button doesn't work. The game I'm making is very close combat and it involves swords that's why. It's like Street Fighter but besides the kicking and stuff it's swords.)

Also I would only like my actor to animate once then when the attack button is pressed again it animates again.

Thanks so much guys, Victor :)

Comments

  • SocksSocks London, UK.Member Posts: 12,822

    When touch is pressed: make attribute true

    Timer, after 1 second, make attribute false.

  • http_gamesaladhttp_gamesalad Member Posts: 1,340

    @Socks Thanks so much!

  • http_gamesaladhttp_gamesalad Member Posts: 1,340

    Do you have a rule to make it work when your close to the enemy? @socks or can give me any ideas of making this work?

  • bjandthekatzbjandthekatz Orlando, FlMember Posts: 1,375

    When magnitude(self.position.x-enemyX,self.position.y-enemyY) < 100
    - Put rule shown above here.
    This will make it so if the enemy is within 100 pixels the rule will fire

    Constrain the enemies position to 2 real game attributes, EnemyX and EnemyY.

  • SocksSocks London, UK.Member Posts: 12,822
    edited May 2014

    ...

  • http_gamesaladhttp_gamesalad Member Posts: 1,340

    @bjandthekatz should I make a new actor and constrain it to the enemy? What should I constrain it to? The enemy, the attack button, or the hero?

  • SocksSocks London, UK.Member Posts: 12,822
    edited May 2014

    ...

  • bjandthekatzbjandthekatz Orlando, FlMember Posts: 1,375

    Create 2 real attributes, one EnemyX, one EnemyY
    Inside the enemy add 2 constrain behaviors.
    Constrain EnemyX to self.position.X
    Constrain EnemyY to self.position.Y

Sign In or Register to comment.