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

#1 2009-06-19 05:09:34

Jonathanpb
Scratcher
Registered: 2008-07-25
Posts: 1000+

How do you get sprites to chase you in a maze?

I am working on a game where you are in a maze and there are evil baddies. Seems simple, but the problem is that I don't know how to make them wander around the maze trying to get you! I understand that you can use the 'set course' method, that is, the baddies repeat a set course. But they do not really move to get you, they just wander around in the same old way. Is there a way for getting the baddies to try and get you in the maze?

Last edited by Jonathanpb (2009-06-23 01:54:23)


"Human beings... must have action; and they will make it if they cannot find it.
-Charlotte Brontë

Offline

 

#2 2009-06-19 07:53:32

imbrainy
Scratcher
Registered: 2009-04-14
Posts: 14

Re: How do you get sprites to chase you in a maze?

I'm not sure if the tutorial woudl cover the maze part, but archmages tuts are very helpful.
You're trying to make a game like pacman, you mean.


http://dragcave.net/image/PaD0.gifhttp://dragcave.net/image/niTG.gifhttp://dragcave.net/image/adH1.gifhttp://dragcave.net/image/rb6h.gif<click them or they will die D:

Offline

 

#3 2009-06-19 09:31:56

filo5
Scratcher
Registered: 2008-01-08
Posts: 1000+

Re: How do you get sprites to chase you in a maze?

Add this to the hero sprite

Code:

When flag clicked
forever
| if <<touching [badguy_1]> or <touching [badguy_2]>>
| |  broadcast [endgame]
| | _
|_

Except that you have to add < < > or < > > block for every enemy you add... You can also use torchlight as a trigger - then use <touching colour [  ]> block. http://planetsmilies.net/dwarf-smiley-5130.gif


Converting my Scratch projects to Python!

Offline

 

#4 2009-06-19 16:34:33

daydreamgirl
Scratcher
Registered: 2009-02-20
Posts: 42

Re: How do you get sprites to chase you in a maze?

I made a game where the enemy chases you around, but it's not a maze. Look at the code for Cat Chase--it might give you some ideas.

http://scratch.mit.edu/projects/daydreamgirl/575932

Last edited by daydreamgirl (2009-06-19 16:36:49)


Test Signature

Offline

 

#5 2009-06-19 16:58:43

archmage
Scratcher
Registered: 2007-05-18
Posts: 1000+

Re: How do you get sprites to chase you in a maze?

Try looking at this project
http://scratch.mit.edu/projects/bigB/15121

What you want to do is put sprites at every turn in the maze and when an enemy touches one of these sprites it determines where to move next.

There is no tutorial for this and scratch and the above advice doesn't seem like it will help much.


Hi, I am Archmage coder extraordinaire. I do Scratch,pascal,java,php,html, AS2 and AS3. Leave me a message if you want coding advice. Also check out my personal website, lots of good stuff about web development, Flash, and Scratch (v1 and v2) !

Offline

 

#6 2009-06-21 02:50:39

Jonathanpb
Scratcher
Registered: 2008-07-25
Posts: 1000+

Re: How do you get sprites to chase you in a maze?

filo5 wrote:

Add this to the hero sprite

Code:

When flag clicked
forever
| if <<touching [badguy_1]> or <touching [badguy_2]>>
| |  broadcast [endgame]
| | _
|_

Except that you have to add < < > or < > > block for every enemy you add... You can also use torchlight as a trigger - then use <touching colour [  ]> block. http://planetsmilies.net/dwarf-smiley-5130.gif

I don't think you understand... the trouble is getting the baddies to move around the maze trying to get you. Not about them touching the good guy and ending the game.
__________________________________________
Even if the internet dies, Scratch shall not.

Last edited by Jonathanpb (2009-06-21 02:52:58)


"Human beings... must have action; and they will make it if they cannot find it.
-Charlotte Brontë

Offline

 

#7 2009-06-21 02:56:33

Jonathanpb
Scratcher
Registered: 2008-07-25
Posts: 1000+

Re: How do you get sprites to chase you in a maze?

archmage wrote:

Try looking at this project
http://scratch.mit.edu/projects/bigB/15121

What you want to do is put sprites at every turn in the maze and when an enemy touches one of these sprites it determines where to move next.

There is no tutorial for this and scratch and the above advice doesn't seem like it will help much.

I think that works! Why didn't I think of that?

So what I'll do is I'll have a sprite that covers all of the points in the maze where you turn, and then the baddies will decide which way to go to get the good guy. Thanks again Archmage!
__________________________________________
Even if the internet dies, Scratch shall not.


"Human beings... must have action; and they will make it if they cannot find it.
-Charlotte Brontë

Offline

 

Board footer