Discuss Scratch

artistically12
Scratcher
21 posts

In a fighting game, how do I make my sprite dodge a hit and still move?

I'm making my first boxing game and it's going well! However, I don't know how to make my sprite dodge while moving as well

when green flag clicked
if <key [s v] pressed?> then
set [State v] to [Dodge]
switch costume to [Dodge v]
wait (.5) secs
switch costume to [Stand v]
end

This was my method and it isn't working because it stops all movement (moving left, right, jumping, etc.) just to do so. It comes out looking awkward.
How can I do this so I am not interrupting any movement?

Last edited by artistically12 (Jan. 17, 2021 06:54:56)

PoIygon
Scratcher
1000+ posts

In a fighting game, how do I make my sprite dodge a hit and still move?

Do you have the game link?
artistically12
Scratcher
21 posts

In a fighting game, how do I make my sprite dodge a hit and still move?

Yeah, it's not done though

https://scratch.mit.edu/projects/473610720

PS. When you click on the “Scratch cat - fight” sprite, The script that has a note above it saying “Combat System”, you may need to click on that script because it doesn't activate on it's own.

Last edited by artistically12 (Jan. 17, 2021 14:00:08)

Dezach
Scratcher
100+ posts

In a fighting game, how do I make my sprite dodge a hit and still move?

Try:
forever
if <key [d v] pressed?> then
...
end
...
if <key [s v] pressed?> then
broadcast [dodge v]
end
end

when I receive [dodge v]
set [state v] to [dodge]
switch costume to [Dodge v]
wait (0.5) secs
switch costume to [Stand v]
artistically12
Scratcher
21 posts

In a fighting game, how do I make my sprite dodge a hit and still move?

Dezach wrote:

Oh wow! It worked, thank you!

artistically12
Scratcher
21 posts

In a fighting game, how do I make my sprite dodge a hit and still move?

Is there any projects that you are working on that you'd like me to check out?
Dezach
Scratcher
100+ posts

In a fighting game, how do I make my sprite dodge a hit and still move?

Your welcome!

Powered by DjangoBB