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

#1 2009-07-31 19:18:29

MasterStrife
Scratcher
Registered: 2009-06-23
Posts: 9

Need help with AI system

I'm new to the side scroller shooting games, and was going to make a half life game on scratch. But I need help with the stupid AI. How to make it shoot at you and randomly hit, the works.
I know:
[blocks]<when green flag clicked>
<forever if><( <distance to[ sprite]> <<> whatever you want )>
<set{ variable }to( <pick random( 0 )to( 10) >[/blocks]

[blocks]<when green flag clicked>
<forever if> <( <{ variable }> <=> 5 or something )>
<change{ p1hp }by( 5>[/blocks]

Last edited by MasterStrife (2009-07-31 19:19:13)

Offline

 

#2 2009-08-01 06:53:28

dav09
Scratcher
Registered: 2009-03-25
Posts: 1000+

Re: Need help with AI system

you could have tiney marks after the shooting sprite aso it could shoot you when touching or you could have if distance from ! thats two ways

Offline

 

#3 2009-08-01 14:00:42

markyparky56
Scratcher
Registered: 2008-03-20
Posts: 1000+

Re: Need help with AI system

try this:

Code:

<when green flag clicked>
<forever>
<if><(  <distance to[ Player ]<<> 300 or whatever )>
(Execute attack)
<end>
<end>

if that doesn't work ill try to to fix it.


http://j.mp/jgVnTq
Check out my game engine development site: NewDawn I'm a Level 171 Scratcher.I am http://bit.ly/nkvLNT

Offline

 

#4 2009-08-10 16:22:40

MasterStrife
Scratcher
Registered: 2009-06-23
Posts: 9

Re: Need help with AI system

Thats exactly what i put up on first post -.-

Offline

 

#5 2009-08-11 11:07:27

markyparky56
Scratcher
Registered: 2008-03-20
Posts: 1000+

Re: Need help with AI system

so, you need help with the shot?

ENEMY
<when green flag clicked>
<forever>
<if><(  <distance to[ Player ]<<> 300 or whatever )>
<broadcast[ fire]
(Execute attack)
<end>
<end>

PLAYER
<when I receive[ fire]
<set{ Ran. }to( <pick random( 1 )to( 0 )
<if><( <{ Ran. }> <=> 1 )>
<change{ Health }by( -1 (or whatever) )
(Execute hurt)
<end>
<end>


http://j.mp/jgVnTq
Check out my game engine development site: NewDawn I'm a Level 171 Scratcher.I am http://bit.ly/nkvLNT

Offline

 

Board footer