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

#1 2010-05-14 08:47:31

teguki
Scratcher
Registered: 2008-03-06
Posts: 72

Overlapping enemies.

Does anyone know of a way to stop any members of a group coming within 18 pixels of one another without stopping one or more of them moving?
It would be really helpful if I could get some tips. What I need is for neither to stop moving, but for both to move away from each other, so that they aren't all being focused in one point. So that they are allowed to bunch together, but not to overlap.

Here's the project:
http://scratch.mit.edu/projects/teguki/1049012

Offline

 

#2 2010-05-14 09:14:35

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

Re: Overlapping enemies.

You might want to use the "distance to []" block under Sensing.


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

Offline

 

#3 2010-05-14 11:12:05

teguki
Scratcher
Registered: 2008-03-06
Posts: 72

Re: Overlapping enemies.

technoguyx wrote:

You might want to use the "distance to []" block under Sensing.

The problem isn't sensing how close other zombies are; that's the easy part. The bit I'm struggling with is how, using that information, to make them avoid each other.

Last edited by teguki (2010-05-14 11:12:30)

Offline

 

#4 2010-05-14 18:07:21

laser100
Scratcher
Registered: 2009-12-04
Posts: 100+

Re: Overlapping enemies.

It could be if distance to {other zombie} is less than 20, move 0 steps, else move 2 steps.
smile

Offline

 

#5 2010-05-15 05:59:27

teguki
Scratcher
Registered: 2008-03-06
Posts: 72

Re: Overlapping enemies.

Wouldn't that make one or more zombies stop moving to let the other past?

Offline

 

Board footer