Pages: 1
Topic closed
I cant figure out how to make enemies shoot at you and keep shooting until they get shot i want them to hit me once out of every couple of shots can someone please make me a script
Last edited by bro94 (2009-12-31 20:26:39)
Offline
Yep, I'd also like to know how to get enemies to shoot at you.
Bowtrol | Web Marketing
Last edited by DermotJones (2010-05-15 15:45:31)
Offline
do you also need help with the sprites?
Offline
Are you making a 1st person shooter? If so, I don't think I can help
Offline
Simply make it so that out of all the shots that hit, only a random amount are counted.
Otherwise, if you are casually asking for someone to code you a Scratch based 1st person shooter, you are out of your mind. Lol, no offense. But seriously though, do some looking around for 1st person shooters, download them, open up their code and see how they did it. Kind of the whole idea around here, I think.
Offline
First, you'll need a trigger that tells a sprite that it's been shot.
Lets say that trigger is the colour red.
First, put this script in your enemy sprites:
<when green flag clicked>
<repeat until><touching color[ red ]>
|<point towards( your sprite )>
|<broadcast[ shoot ]and wait c>
<end>
Now, also add this to the enemy's bullet sprite:
<when I receive[ shoot ]>
<show>
<go to[ enemy ]>
<pen down>
<point in direction( <[direction] of [enemy]> )>
<repeat until><touching[ your sprite ]>
|<move( 2 )steps>
<end>
<pen up>
<hide>
The bullet sprite should be red, or you should add
<set pen color to( red )>
Finally, add this to your sprite:
<when green flag clicked>
<forever if><touching color[ red ]>
|<if><( <pick random( 1 )to( 5 )) <=> 5 )>
||<broadcast[ game over ]>
|<end>
<end>
The game over message will tell you when you are dead.
Last edited by billyedward (2010-01-23 15:00:59)
Offline
Topic closed
Pages: 1