This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2013-01-11 11:50:34

Gagamonster105
Scratcher
Registered: 2012-11-29
Posts: 100+

Sword fighting

I need help with a sprite sword fighting. The sprite has a sword and he needs to stab the other. PLEASE HELP!!!


http://i46.tinypic.com/14bklrq.png <click

Offline

 

#2 2013-01-11 12:57:02

iaoumeur
Scratcher
Registered: 2012-11-24
Posts: 500+

Re: Sword fighting

Hey, Gagamonster,

You could just do this and space could be the signal to attack

when (space v) key pressed
switch to costume (costume with sword being thrusted)
Hope this helps!

Last edited by iaoumeur (2013-01-11 12:57:48)


The Dot 3 is out!!! Play it here!

Offline

 

#3 2013-01-11 16:55:25

BLU_Spy
Scratcher
Registered: 2012-01-05
Posts: 1000+

Re: Sword fighting

And for the damage, use this command for the enemy:

when gf clicked
switch to costume [idle v]
set [EnemyHP v] to (100)
forever
wait until <<touching [player v]?> and <([costume # v] of [player v]) = (attack costume's #)>> 
switch to costume [hurt v]
change [EnemyHP v] by (-1)
wait (1) secs
switch to costume [idle v]
The "idle" and "hurt" costumes are optional. You can also use a hit sound if you want.

The (attack costume's #) is not a real variable. It must be replaced with the number of the costume of the "player" sprite swinging the sword.

Last edited by BLU_Spy (2013-01-11 17:01:35)


I HAVE SWITCHED ACCOUNTS! My new username is NoxSpooth.

Offline

 

Board footer