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

#1 2008-08-13 10:47:16

nerdman
Scratcher
Registered: 2008-04-25
Posts: 37

Anyone know how to make AI ?

Please help me could someone show me ho to do it or at least give me an example


Pie or Cake... for the cake is a lie I'd say pie. Though millions may disagree...

Offline

 

#2 2008-08-13 11:08:28

1jim3bob
Scratcher
Registered: 2008-07-30
Posts: 86

Re: Anyone know how to make AI ?

http://scratch.mit.edu/projects/Bobby500/239173 That project should help you.

Offline

 

#3 2008-08-13 15:56:48

dingdong
Scratcher
Registered: 2007-08-09
Posts: 1000+

Re: Anyone know how to make AI ?

AI works by detecting the X and Y position of your player
basically:
forever
if Xposition < Xpoistion of player unit
     change X by (positive number)
if Xposition > Xpoistion of player unit
     change X by (negative number)

if you've learned shooting this is another technique

forever
if distance to player unit < 150
    (add all the shooting activation scripts in here)

also don't forget to add this, you can also put this within the movement
side scroller:
forever
if Xposition < Xpoistion of player unit
     point in direction (90)
if Xposition > Xpoistion of player unit
     point in direction (-90)

overworld:
forever
point towards [player unit]

you can also change it to this
forever
if distance to player unit < 200
    point towards [player unit]

I'm currently working with a scrolling AI that when it bumps into a wall it will find a way around it, however that's where things can get pretty complex


http://img851.imageshack.us/img851/2829/superanbanner.png
click the image for my music

Offline

 

Board footer