Help with sword attack

0 favourites
  • 2 posts
From the Asset Store
Game with complete Source-Code (Construct 3 / .c3p) + HTML5 Exported.
  • Hello everyone,

    I'm creating a platform game and I'm having some issues with my sword attack. Here is my demo dl.dropboxusercontent.com/u/8017129/folclore-minado/index.html. and here is my .capx file dl.dropboxusercontent.com/u/8017129/folclore-minado/capxfile.capx

    First problem: When I'm facing left, my sword attacks to the right anyway.I already tried to use the mirror effect but nothing happen.

    Second problem: As you can see, it's taking too long to my sword spawn another object to collide with the enemy and kill it. And if I jump and attack at the same time, my player create spawn object at wrong positions and times. I know I have to destroy the spawn object, but I didn't yet because this problem.

    To jump is up arrow

    To walk is left and right arrow

    And to attack is Z

    Hope somebody can help me out, thanks in advance! <img src="smileys/smiley1.gif" border="0" align="middle" />

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • First problem: When I'm facing left, my sword attacks to the right anyway.I already tried to use the mirror effect but nothing happen.

    This is because you're moving the sword by changing it's angle. If you set a sprite's angle to 45 degrees, it won't change angles by mirroring the sprite. If you want to swing the swrong to the left by changing the sprite's angle, you'll need to move the sprite in the opposite direction as a right facing swing.

    I think you'd be much better of creating an animation of the sword swinging rather than manipulate its angles. That way, mirroring the sprite would work, and you wouldn't have to fool around with wait commands (see 2nd issue). However, I've never messed around with sword mechanics in C2, so perhaps someone with experience can comment on which method is appropriate.

    Second problem: As you can see, it's taking too long to my sword spawn another object to collide with the enemy and kill it. And if I jump and attack at the same time, my player create spawn object at wrong positions and times. I know I have to destroy the spawn object, but I didn't yet because this problem.

    This is due to all the wait commands. You have the sword finish swining, and then a wait command of 0.5 seconds, and then the hitbox is created. Those 0.5 seconds are what is causing the delay. Spawning the hit box before the wait command is a quick fix.

    I made a few changes to your capx that that fix the issues you discussed, but it's probably worth exploring other more efficient sword mechanics.

    Capx

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)