My character won't attack when idle?

0 favourites
  • 8 posts
From the Asset Store
2d warrior machrom platformer game character assets
  • Hello! Firstly, thank you for taking the time to read this and consider helping. My issue is, as of right now, that I cannot get my player to attack while idle. When running, if 'Z' is pressed, he will attack, and it will also work while in mid-air, as I wanted it to be. Here is my event sheet:

    Any suggestions on how to resolve this issue would be greatly appreciated.

  • Idle and not attack must be problem at 19 row.

    Just copy it and put new condition or sub event.. Press Z like at 17 row( put this in the new condition or new sub event under the copy of 19 row . You maybe want to get rip off the 2 action

  • Idle and not attack must be problem at 19 row.

    Just copy it and put new condition or sub event.. Press Z like at 17 row( put this in the new condition or new sub event under the copy of 19 row . You maybe want to get rip off the 2 action

    I'm having a new problem though. After going back and closely looking at a tutorial, I made an attempt to copy it. Now my character responds when I press 'Z', although he freezes on the first frame until i move.

  • MM. that suck.. Why dont you report it at Bug section.. Maybe Scirra founder know something about it

  • In the same tick ....

    19 sets the attack1 animation.

    25 sets the attack1 animation.

    28 sets the attack1 animation.

    At least 2 of those 3 is true, mostly all 3. And they stay true for quite some time.

    So, the animation gets started several times in 1 tick for a lot of ticks in a row.

    Result: the animation starts to playing and never gets passed frame 1.

    Because, before it ever gets to frame 2, its is commanded to start from beginning (frame 1) again.

    And again, and again, and again, and again.

    I would like to see the tutorial, i do not beleive it makes the same mistakes.

    Even if you solve this one thing, the code stays a mess. I expect it to be the same mess in the player movement section.

    I suppose 'fly', 'idle' and 'run' also get started in that section. Meaning without a capx, this is not solvable.

    Excuse me the harsh words, but i suggest: Start over. And use 'Trigger once while true' when needed.

  • In the same tick ....

    19 sets the attack1 animation.

    25 sets the attack1 animation.

    28 sets the attack1 animation.

    At least 2 of those 3 is true, mostly all 3. And they stay true for quite some time.

    So, the animation gets started several times in 1 tick for a lot of ticks in a row.

    Result: the animation starts to playing and never gets passed frame 1.

    Because, before it ever gets to frame 2, its is commanded to start from beginning (frame 1) again.

    And again, and again, and again, and again.

    I would like to see the tutorial, i do not beleive it makes the same mistakes.

    Even if you solve this one thing, the code stays a mess. I expect it to be the same mess in the player movement section.

    I suppose 'fly', 'idle' and 'run' also get started in that section. Meaning without a capx, this is not solvable.

    Excuse me the harsh words, but i suggest: Start over. And use 'Trigger once while true' when needed.

    I'd like to apologize for displaying such a sloppy looking list of events and actions; I am still new to this program, but I do appreciate your assistance. I think I'm beginning to understand what you're saying in regards to the same tick executing the animation three times over. The original tutorial for attacking is here, although I did attempt to modify some things (to my inevitable failure) when programming it for myself. https://www.scirra.com/tutorials/386/how-to-make-a-player-atack

    Now I am having another issue, where he is no longer frozen, but instead the attack animation does not play at all when idle.

    Here is the capx : https://www.dropbox.com/s/9ojwyxzjmq2ybgd/OVERTHROW_REMAKE.capx?dl=0

    ( I tried to make my events neater by adding in another group; I hope you don't mind. )

  • I appologize 4 sounding so harsh. But sometimes you need someone who kicks a little.

    Plz test this CAPX trough. I might have forgotten something.

    You will notice (i hope you do) 3 importand things.

    https://www.dropbox.com/s/jpfmgdz554mr5 ... .capx?dl=0

    1/ Changing direction, velocity and all that stuff must happen inmediatly, and must be able to happen fast. The animations can only happen only once when there is a change in the situation. Thats is why you cant change animations and those other things in the same event. They have a totaly differend ritme. Hence, animations get there own dedicated events.

    2/ Each animation (when its top event aint a trigger) has a 'once while true'.

    3/ Each animation has only ONE event to get it started. No where else in the whole event-sheet an animation has another event that starts it. As you see that is possible using 'else' statements. Those else statements also make it a dang sure thing that there is only ONE animation (out of differend) started in whole that event block. You see ?

    There are things i dont know. Can it attack while gliding ? I supposed it can. But, this must be easy to change for you now. Because you see ALL animations grouped thogher in a big hug.

    I plain love the way how you make it glide, that i learned from you.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I appologize 4 sounding so harsh. But sometimes you need someone who kicks a little.

    Plz test this CAPX trough. I might have forgotten something.

    You will notice (i hope you do) 3 importand things.

    https://www.dropbox.com/s/jpfmgdz554mr5 ... .capx?dl=0

    1/ Changing direction, velocity and all that stuff must happen inmediatly, and must be able to happen fast. The animations can only happen only once when there is a change in the situation. Thats is why you cant change animations and those other things in the same event. They have a totaly differend ritme. Hence, animations get there own dedicated events.

    2/ Each animation (when its top event aint a trigger) has a 'once while true'.

    3/ Each animation has only ONE event to get it started. No where else in the whole event-sheet an animation has another event that starts it. As you see that is possible using 'else' statements. Those else statements also make it a dang sure thing that there is only ONE animation (out of differend) started in whole that event block. You see ?

    There are things i dont know. Can it attack while gliding ? I supposed it can. But, this must be easy to change for you now. Because you see ALL animations grouped thogher in a big hug.

    I plain love the way how you make it glide, that i learned from you.

    Oh my god you're wonderful, you fixed it ahh! Thank you so much, I've learned a lot! And I'm glad I was able to teach you something in turn as well! Lots of love to you, my friend. <img src="{SMILIES_PATH}/icon_mrgreen.gif" alt=":mrgreen:" title="Mr. Green">

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