Discuss Scratch

XxShockWavezxX
Scratcher
16 posts

My characters need to fight!

Hi everyone
I am developing fighting game on scratch that can be found here : https://scratch.mit.edu/projects/57476904/#editor
Anyway i need help on making the characters do damage to each other. I f anyone knows how to do this it would
be appreciated if they could help me with this game. yes i will give credit.

when I receive [answer v]
say [thanks]

Last edited by XxShockWavezxX (May 21, 2015 15:29:27)

Karsten100
Scratcher
26 posts

My characters need to fight!

2 ways you could do it:

1) Touching
This is an easier approach, seeing as you don't have to define an attack range, but will not work as well because the two characters have to be touching to attack.
if <touching [enemy v] ?> then
if <mouse down?> then
change [enemyhealth v] by (-1)
end
end

2) x-y positions
This approach takes a little more time but is much better as it has an attack range, and only lets you hit people in front of you.
if <(direction) = [right]> then
if <<((x position) - ([x position v] of [enemy v])) > [-10]> and <([x position v] of [enemy v]) > (x position)>> then
if <mouse down?> then
change [enemyhp v] by (-1)
end
end
else
if <<((x position) - ([x position v] of [enemy v])) < [10]> and <([x position v] of [enemy v]) < (x position)>> then
if <mouse down?> then
change [enemyhp v] by (-1)
end
end
end

Last edited by Karsten100 (May 21, 2015 18:05:10)


You won't be unknown anymore

Free custom utility blocks here!
languagegal14
Scratcher
500+ posts

My characters need to fight!

If you actually want the visual, like sorta a pinata effect, do something like….
if <touching [sprite1 v] ?> then

next costume
end
if <(costume #) = [last ]> then

hide
change [points v] by (0)
end

say [Thank you!:)] for (2) secs
Need help with school? Look no further! https://scratch.mit.edu/studios/1151284/
Please check out my Role play competition, Color Wars! https://scratch.mit.edu/projects/73548968/
XxShockWavezxX
Scratcher
16 posts

My characters need to fight!

thanks for the help but none of these scripts seem to be working…
languagegal14
Scratcher
500+ posts

My characters need to fight!

The costume number script can be a little glitchy, and you actually have to put a number in there, but the other scripts should work fine…

say [Thank you!:)] for (2) secs
Need help with school? Look no further! https://scratch.mit.edu/studios/1151284/
Please check out my Role play competition, Color Wars! https://scratch.mit.edu/projects/73548968/
RedThumb
Scratcher
100+ posts

My characters need to fight!

Have my own damage system script:

For your main character sprite:
when green flag clicked
forever

if <(distance to [enemy v]) < [10]> then
if <key [space bar v] pressed?> then
broadcast [enemy got damaged v]
wait until <not <key [space bar v] pressed?>>

end


end

end

And for the enemy sprite:
when I receive [enemy got damaged v]
change [life v] by (-5)

I hope this will help you out.

Check out my projects!
What I'm currently working on:
XxShockWavezxX
Scratcher
16 posts

My characters need to fight!

Thanks everyone but i created a script that works.. thanks anyway

forever

say [thanks] for (2) secs
end

Last edited by XxShockWavezxX (May 23, 2015 01:00:52)

Powered by DjangoBB