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

#1 2009-04-06 11:10:09

DBolweevil
Scratcher
Registered: 2007-09-08
Posts: 2

Attacking Enemy...

Ok, so I'm currently working on a game where its the player against an enemy. Regular stuff. But, I don't know how to make the enemy be able to react to the players actions (evade, charge in the right place, etc.). so I was wondering if anyone could either tell or show me how to do this?

Offline

 

#2 2009-04-06 12:25:54

Orocles
Scratcher
Registered: 2009-04-06
Posts: 6

Re: Attacking Enemy...

Yeah, I'm stuck as well...


Actually, this might work:
put a [blocks] <pick random(  )to(  )> [/blocks]
and then put underneath if [blocks] <pick random(  )to(  )> [/blocks] =1, do this, and so on.

Offline

 

#3 2009-04-06 18:37:44

Paddle2See
Scratch Team
Registered: 2007-10-27
Posts: 1000+

Re: Attacking Enemy...

It's hard to give specific advice without knowing how your game works.  I have an example of a simple AI I designed for a face to face shooter game.  The AI player spends a portion of it's time being defensive and another portion being offensive.  If it senses that it is being shot at, it will try to evade the shot.  It uses the "pick random" block to switch between offensive and defensive.  Take a look, maybe you will find it helpful

http://scratch.mit.edu/projects/Paddle2SeeFixIt/207393

There's a whole gallery of AI type projects here too...

http://scratch.mit.edu/galleries/view/24082


http://i39.tinypic.com/2nav6o7.gif

Offline

 

#4 2009-04-06 19:08:20

golfer3
Scratcher
Registered: 2008-11-02
Posts: 1000+

Re: Attacking Enemy...

I find this helpful for your problem oracles + DBolweevil: its made by paddles2see but seems very helpful. http://scratch.mit.edu/projects/Paddle2SeeFixIt/207393

Offline

 

#5 2009-04-08 10:57:22

DBolweevil
Scratcher
Registered: 2007-09-08
Posts: 2

Re: Attacking Enemy...

Alright, I think I may have it. Thanks guys. The first kind of thing I put up (before I first posted) is here:
http://scratch.mit.edu/projects/DBolweevil/459812
my goal for the game is for there to be a cpu with the same moves as you, but it'll attack on its own and whatnot.

Offline

 

Board footer