How do I make my player top moving when attacking?

Get help using Construct 2

Post » Tue Feb 28, 2017 1:17 am

Hey everyone,
I wonder how I can stop my character from moving when he is in attack animation.

Thanks in Advance!
B
3
Posts: 6
Reputation: 187

Post » Tue Feb 28, 2017 2:16 am

just don't simulate the right and left if in plat-former or in 8-direction when attacking. update us if it works :D
B
79
S
31
G
7
Posts: 148
Reputation: 9,179

Post » Tue Feb 28, 2017 3:28 am

Sounds like that would do the trick but I can't figure out where these options are found :(
B
3
Posts: 6
Reputation: 187

Post » Tue Feb 28, 2017 3:39 am

can you send your capx? :D
B
79
S
31
G
7
Posts: 148
Reputation: 9,179

Post » Tue Feb 28, 2017 3:57 am

Message: steenert can only post plain text URLS until they have 500 rep. 1 URLS modified. Why?
Yeah here you go :)
http://www80.zippyshare.com/v/Qld2E7MZ/file.html
B
3
Posts: 6
Reputation: 187

Post » Tue Feb 28, 2017 5:27 am

i can't download it :(
B
79
S
31
G
7
Posts: 148
Reputation: 9,179

Post » Tue Feb 28, 2017 11:43 am

Message: steenert can only post plain text URLS until they have 500 rep. 1 URLS modified. Why?
Hmm try this one then,

https://www.dropbox.com/s/slplsab4akylast/Project.capx?dl=0
B
3
Posts: 6
Reputation: 187

Post » Tue Feb 28, 2017 3:27 pm

If you want the player to only attack when not moving, simply add an event similar to the one below.

Keyboard > on [attack key] pressed >>> Player > set animation to [attack animation]

then, add a condition (right click on event and select add... and click condition).

Player > compare speed > equal to 0

and then add another event so you can get out of the attack animation.
I'm not positive if this part works unless you replace: on [attack key] pressed with [attack key] is down. try that.

Keyboard > on [attack key] released >>> Player > set animation to [default animation]

I hope this helps!

EDIT: alternatively, if you want your player to stop when attacking and you're using plat former, use these commands:

Keyboard > [attack button] is down >>> Player > set Maximum speed to 0 > set acceleration to 0 > set deceleration to 0 > set animation to [attack animation]

Keyboard > [attack button] released >>> Player > set Maximum speed to [original max speed] > set acceleration to [original acceleration] > set deceleration to [original deceleration] > set animation to [default animation]

That might be more of what you're looking for.
Last edited by Captain Awesome on Tue Feb 28, 2017 4:05 pm, edited 1 time in total.
-Captain Awesome

-Your everyday guy that attempts to create slightly good games.
B
22
S
9
G
5
Posts: 9
Reputation: 8,903

Post » Tue Feb 28, 2017 4:01 pm

Captain Awesome wrote:If you want the player to only attack when not moving, simply add an event similar to the one below.

Keyboard > on [attack key] pressed >>> Player > set animation to [attack animation]

then, add a condition (right click on event and select add... and click condition).

Player > compare speed > equal to 0

and then add another event so you can get out of the attack animation.
I'm not positive if this part works unless you replace: on [attack key] pressed with [attack key] is down. try that.

Keyboard > on [attack key] released >>> Player > set animation to [default animation]

I hope this helps!


What if I want the attack animation to cause the player to stop moving? Example: you press Z and that causes the player to stop moving and start his attack animation.
B
3
Posts: 6
Reputation: 187

Post » Tue Feb 28, 2017 4:07 pm

Look above, I just posted an additional option which might help with that.
-Captain Awesome

-Your everyday guy that attempts to create slightly good games.
B
22
S
9
G
5
Posts: 9
Reputation: 8,903

Next

Return to How do I....?

Who is online

Users browsing this forum: DiegoSanudoDT, R0J0hound and 10 guests