My character won't attack when idle?

Get help using Construct 2

Post » Mon Jun 06, 2016 12:44 am

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:

Image

Any suggestions on how to resolve this issue would be greatly appreciated. :)
B
13
S
2
Posts: 11
Reputation: 647

Post » Mon Jun 06, 2016 2:09 am

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
B
13
S
5
G
4
Posts: 119
Reputation: 3,353

Post » Mon Jun 06, 2016 12:37 pm

fathijack1999 wrote: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.

Image
B
13
S
2
Posts: 11
Reputation: 647

Post » Mon Jun 06, 2016 2:01 pm

MM. that suck.. Why dont you report it at Bug section.. Maybe Scirra founder know something about it :?
B
13
S
5
G
4
Posts: 119
Reputation: 3,353

Post » Mon Jun 06, 2016 4:46 pm

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.
B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950

Post » Mon Jun 06, 2016 5:31 pm

99Instances2Go wrote: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. )
B
13
S
2
Posts: 11
Reputation: 647

Post » Mon Jun 06, 2016 9:51 pm

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.
B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950

Post » Mon Jun 06, 2016 11:06 pm

99Instances2Go wrote: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. :mrgreen:
B
13
S
2
Posts: 11
Reputation: 647


Return to How do I....?

Who is online

Users browsing this forum: max2612, Yahoo [Bot] and 27 guests