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

#1 2013-02-21 20:24:40

fivehead
Scratcher
Registered: 2010-05-15
Posts: 500+

Artificial intelligence help

I am making a Star Wars game and i want stormtroopers to walk to somewhere random after they spawn and then shoot at you. If anybody would help that would be awesome  big_smile

Last edited by fivehead (2013-02-21 20:41:31)


Goodbye 1.4  sad
http://24.media.tumblr.com/tumblr_mc7sst6hKv1rghkxeo1_500.gifhttp://24.media.tumblr.com/tumblr_mctyxwHfGI1rghkxeo6_250.gif

Offline

 

#2 2013-02-22 06:16:08

shadowmouse
New Scratcher
Registered: 2013-02-03
Posts: 100+

Re: Artificial intelligence help

Use something along the lines of

glide to x: (pick random (-240) to (240)) y: (pick random (-180) to (180))
point towards [player sprite v]
shoot

Offline

 

#3 2013-02-22 06:23:22

shadowmouse
New Scratcher
Registered: 2013-02-03
Posts: 100+

Re: Artificial intelligence help

sorry, the first block was meant to be

glide (2) secs to x: (pick random (-240) to (240)) y: (pick random (-180) to (180))

Offline

 

#4 2013-02-22 08:27:33

fivehead
Scratcher
Registered: 2010-05-15
Posts: 500+

Re: Artificial intelligence help

if the player moves will the enemy still point towards the player?


Goodbye 1.4  sad
http://24.media.tumblr.com/tumblr_mc7sst6hKv1rghkxeo1_500.gifhttp://24.media.tumblr.com/tumblr_mctyxwHfGI1rghkxeo6_250.gif

Offline

 

#5 2013-02-22 09:25:02

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

Re: Artificial intelligence help

fivehead wrote:

if the player moves will the enemy still point towards the player?

Well it depends on the shooting script that you use. In some cases, yes, though in others, no.

With regards,

ErnieParke


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

Offline

 

#6 2013-02-22 11:33:29

CAA14
Scratcher
Registered: 2013-01-14
Posts: 1000+

Re: Artificial intelligence help

Hi,

Here is some A.I. cubes, you are welcome to use/modify the scripts.
If you do, please leave credit.  smile

Regards,

CAA14

Offline

 

#7 2013-02-22 12:13:14

firedrake969_test
Scratcher
Registered: 2012-08-08
Posts: 500+

Re: Artificial intelligence help

Back when I was a n00b programmer, I made this:  http://scratch.mit.edu/projects/Firedrake969/2173697
If you want to have them point and shoot, use point towards sprite, then the shooting script.


Alt of Firedrake969.

Offline

 

Board footer