Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » How do I make an enemy on a game that has a mind of its own? (sort of)
- Tommy100
-
100+ posts
How do I make an enemy on a game that has a mind of its own? (sort of)
I'm making a game that is kind of like pac man. Except that you are not allowed to kill the enemies. And I was wondering how I make an enemy that kind of has a mind of its own. So it randomly goes around the maze. Except that I do not want it to go right through parts of the maze. I want it to go as it should so that when it goes around the maze is doesn't touch a wall. Please help me!
- DudmasterUltra
-
100+ posts
How do I make an enemy on a game that has a mind of its own? (sort of)
You can use the random block to create random numbers, and the if statement to tell which path it will take. Pac-Man ai is a little tougher than regular since they have to not go through walls. Maybe you figure something out using glide blocks and random
- CatScratchDeluxe
-
11 posts
How do I make an enemy on a game that has a mind of its own? (sort of)
I'm pretty sure the enemies should have something like this;
Make something else to make it avoid the walls like
The blank space should make it unable to go through the wall
- Tommy100
-
100+ posts
How do I make an enemy on a game that has a mind of its own? (sort of)
I tried that but the problem is that I want levels too. And the levels have different pathways… So it would take a LONG TIME to do that! Any other suggestions? You can use the random block to create random numbers, and the if statement to tell which path it will take. Pac-Man ai is a little tougher than regular since they have to not go through walls. Maybe you figure something out using glide blocks and random
- Tommy100
-
100+ posts
How do I make an enemy on a game that has a mind of its own? (sort of)
Thanks I will try that but I don't know if it will work. Everyone I'm still open for suggestions! I'm pretty sure the enemies should have something like this;Make something else to make it avoid the walls likeThe blank space should make it unable to go through the wall
- RichardStarbright
-
38 posts
How do I make an enemy on a game that has a mind of its own? (sort of)
See http://scratch.mit.edu/projects/23515861/ , it is a good example of a computer having a “mind of its own”
- excelguru
-
1000+ posts
How do I make an enemy on a game that has a mind of its own? (sort of)
Maybe something like this:
- deck26
-
1000+ posts
How do I make an enemy on a game that has a mind of its own? (sort of)
That's the sort of thing I think a grid system is useful for. I did a tutorial here http://scratch.mit.edu/projects/47150778/
- Harakou
-
1000+ posts
How do I make an enemy on a game that has a mind of its own? (sort of)
Thanks, but this thread is over half a year old - please check the date before posting! Closing this, but if the thread owner wants this open again, they can just report it and ask. Maybe something like this:

- Discussion Forums
- » Help with Scripts
-
» How do I make an enemy on a game that has a mind of its own? (sort of)