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

#1 2013-01-09 13:33:49

BunnyFire
New Scratcher
Registered: 2012-12-18
Posts: 7

A ninja shooting darts Help! o.o

I am making a ninja game where he shoots darts to get rid of his enemies but i don't know which scripts to use to make that work so that he shoots and kills ememies D:

Offline

 

#2 2013-01-09 16:16:12

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

Re: A ninja shooting darts Help! o.o

Maybe I can help you...

Ninja

when gf clicked
forever
wait (0.1) secs
wait until <key [space v] pressed?>
broadcast [shoot v] and wait
Dart
when gf clicked
hide
go to [ninja v]
when i receive [shoot v]
show
repeat until <<touching [edge v]?> or <touching [enemy v]?>>
move [10] steps
hide
go to [ninja v]
Enemy
when gf clicked
wait (0.1) secs
set [enemy HP v] to (100)
forever
wait until <touching [dart v]?>
change [enemy HP v] by (-1)
wait (0.1) secs

Last edited by BLU_Spy (2013-01-09 17:41:18)


I HAVE SWITCHED ACCOUNTS! My new username is NoxSpooth.

Offline

 

#3 2013-01-09 16:24:47

ErnieParke
Scratcher
Registered: 2010-12-03
Posts: 1000+

Re: A ninja shooting darts Help! o.o

BLU_Spy wrote:

Maybe I can help you...

Ninja

when gf clicked
forever
wait (0.1) secs
wait until <key [space v] pressed?>
broadcast [shoot v] and wait
Dart
when gf clicked
hide
go to [ninja v]
when i receive [shoot v]
show
repeat until <<touching [edge v]?> or <touching [enemy v]?>>
move (10) steps
hide
go to [ninja v]
end
Enemy
when gf clicked
wait (0.1) secs
set [enemy HP v] to (100)
forever
wait until <touching [dart v]?>
change [enemy HP v] by (-1)
wait (0.1) secs

Fixed a few parts.


http://i46.tinypic.com/35ismmc.png

Offline

 

#4 2013-01-09 17:41:59

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

Re: A ninja shooting darts Help! o.o

ErnieParke wrote:

BLU_Spy wrote:

Maybe I can help you...

Ninja

when gf clicked
forever
wait (0.1) secs
wait until <key [space v] pressed?>
broadcast [shoot v] and wait
Dart
when gf clicked
hide
go to [ninja v]
when i receive [shoot v]
show
repeat until <<touching [edge v]?> or <touching [enemy v]?>>
move (10) steps
hide
go to [ninja v]
end
Enemy
when gf clicked
wait (0.1) secs
set [enemy HP v] to (100)
forever
wait until <touching [dart v]?>
change [enemy HP v] by (-1)
wait (0.1) secs

Fixed a few parts.

Oh...

Edited original post.Thanks!

Last edited by BLU_Spy (2013-01-09 17:51:08)


I HAVE SWITCHED ACCOUNTS! My new username is NoxSpooth.

Offline

 

#5 2013-01-10 01:26:38

Aditya007
Scratcher
Registered: 2012-11-27
Posts: 63

Re: A ninja shooting darts Help! o.o

All above is correct, but tell dart to point towards Enemy or it should just straight


Wolf_OS!!!  smile  Check My Stuff  tongue  Need Help?  Currently, I am http://blocks.scratchr.org/API.php?user=Aditya007&amp;action=onlineStatus&amp;type=square
http://i49.tinypic.com/15gy1j6.jpg

Offline

 

#6 2013-01-10 20:53:42

ErnieParke
Scratcher
Registered: 2010-12-03
Posts: 1000+

Re: A ninja shooting darts Help! o.o

BLU_Spy wrote:

ErnieParke wrote:

BLU_Spy wrote:

Maybe I can help you...

Ninja

when gf clicked
forever
wait (0.1) secs
wait until <key [space v] pressed?>
broadcast [shoot v] and wait
Dart
when gf clicked
hide
go to [ninja v]
when i receive [shoot v]
show
repeat until <<touching [edge v]?> or <touching [enemy v]?>>
move (10) steps
hide
go to [ninja v]
end
Enemy
when gf clicked
wait (0.1) secs
set [enemy HP v] to (100)
forever
wait until <touching [dart v]?>
change [enemy HP v] by (-1)
wait (0.1) secs

Fixed a few parts.

Oh...

Edited original post.Thanks!

Your welcome!  smile

Last edited by ErnieParke (2013-01-11 16:47:56)


http://i46.tinypic.com/35ismmc.png

Offline

 

#7 2013-01-12 00:35:26

iNKGaming
New Scratcher
Registered: 2012-07-18
Posts: 18

Re: A ninja shooting darts Help! o.o

....and here's an alternate method, which I believe is a bit more efficient.
[Sorry for the long post]
-------------------------------------------------

When Flag Clicked:
Hide
Repeat until (HP < 0.01)
[

If (Key [Key of your choice] pressed?)
[
Set [Velocity] to 3
Go to [Player]
Point in direction [Direction] of [Player]
Show

Repeat [10]
[

Move [Velocity] Steps
Change [Velocity] by 3

If (Touching [Edge])
[ Hide ] //End of "If touching edge" script.
] //End of repeat loop.

If (Touching [Enemy])
[ Change [Enemy HP] by -1 ] //End of "If touching enemy".

] //End of "If [key] pressed?"

] //End of "Repeat until [HP<0.01]"

-------------------------------------------------
This allows for acceleration. Play with the amount you change Velocity by for a slow or faster acceleration rate, and mess with the amount you set Velocity to at the beginning to change the initial speed. And, finally, changing the number of times the movement is repeated will change the rate of fire, end velocity, and range.

My gripe with the above scripts is first that it requires several scripts, second, the more frequently the dart hits the edge or the enemy increases the firing rate, which I suppose is fine, however, personally, I'd shoot for a more consistent approach. And the final nitpick is there's not acceleration to the bolt, which simply doesn't look quite as nice. However, in principle, what the others have posted is great, and will certainly work.

Happy scratching,
- iNK

Offline

 

Board footer