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

#1 2009-12-31 19:53:44

bro94
Scratcher
Registered: 2009-12-31
Posts: 2

help me: Make first person enemies shoot at you

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

 

#2 2010-01-04 18:26:53

ddaatt
Scratcher
Registered: 2009-11-13
Posts: 1

Re: help me: Make first person enemies shoot at you

I need help with that too. I will keep trying and if i get it i will tell you


then it exploded

Offline

 

#3 2010-01-07 05:33:11

DermotJones
Scratcher
Registered: 2010-01-07
Posts: 2

Re: help me: Make first person enemies shoot at you

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

 

#4 2010-01-07 12:42:30

everythingRhymes
Scratcher
Registered: 2009-12-03
Posts: 100+

Re: help me: Make first person enemies shoot at you

do you also need help with the sprites?

Offline

 

#5 2010-01-08 09:06:49

technoguyx
Scratcher
Registered: 2008-10-18
Posts: 1000+

Re: help me: Make first person enemies shoot at you

Are you making a 1st person shooter? If so, I don't think I can help  hmm


http://getgnulinux.org/links/en/linuxliberated_4_78x116.png

Offline

 

#6 2010-01-22 02:34:34

Locomule
Scratcher
Registered: 2009-08-24
Posts: 500+

Re: help me: Make first person enemies shoot at you

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.


aka Pain from DragonSpires, Delrith Online, BotBattle, Urban Dead etc etc lol

Offline

 

#7 2010-01-23 14:57:22

billyedward
Scratcher
Registered: 2008-01-03
Posts: 500+

Re: help me: Make first person enemies shoot at you

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)


"I'd love to change the world, but they haven't released the source code yet."
Check out the latest version of Streak --> http://billy.scienceontheweb.net/Streak

Offline

 

Board footer