Discuss Scratch

MrEsch
Scratcher
13 posts

Random maze movement

Hello

I have been developing a Pacman game for my students to look at. The key concepts are about how sprites can deal with wall collisions and getting sprites to randomly move around a maze.

Here is my game so far http://scratch.mit.edu/projects/10181896/

I was wondering whether anyone would be able to help me with the following things:

1. The pacman struggled to get around the maze - anyone managed to script anything which allows smooth movement within the maze?
2, I want to get ghosts moving around mazes better.

I would really like some simple concepts which could be shared with young Scratch programmers, whereby they can check out the code and develop it further. Would anyone be interested in making a quick game to demonstrate this?

Thanks in anticipation!















mitchboy
Scratcher
1000+ posts

Random maze movement

MrEsch wrote:

Hello

I have been developing a Pacman game for my students to look at. The key concepts are about how sprites can deal with wall collisions and getting sprites to randomly move around a maze.

Here is my game so far http://scratch.mit.edu/projects/10181896/

I was wondering whether anyone would be able to help me with the following things:

1. The pacman struggled to get around the maze - anyone managed to script anything which allows smooth movement within the maze?
2, I want to get ghosts moving around mazes better.

I would really like some simple concepts which could be shared with young Scratch programmers, whereby they can check out the code and develop it further. Would anyone be interested in making a quick game to demonstrate this?

Thanks in anticipation!
Check out this project.

However, this doesn't quite work, as it's not random and Blinky can only sense where there's a dead end. It can't detect if there's an opening to the left or right unless the path ends. Here's how I would (and probably will) do it: (also noted here)
1. Make a sensor sprite for each of the ghosts and Pacman.
2. Have the sensor sprites detect how many openings there are
3. Make a script so that based on the number of openings there are, a certain thing would happen.

Hope this helps!
MrEsch
Scratcher
13 posts

Random maze movement

Interesting. I have made a random turn, so that it will turn if it hits a wall. I am still not sure how to get it to detect an opening.

YouTube is usually my friend, but there doesn't appear to be much out there on this topic! I have been told that making your stage more of a grid would help, but not quite sure how to achieve this.
PH-zero
Scratcher
100+ posts

Random maze movement

I also tried to make a pacman game.
But i've never finished it because there were some problems
i could not handle so i didn't upload it, but if you want to look at it
i can upload it for you.

Movement of pacman works well but the ghost AI got brocken somehow.
S1lv3rc4tch
Scratcher
11 posts

Random maze movement

Btw you can hide the variables so you can see the whole screen if you want. Just go to the variables tab and uncheck the box next to the variables you want to hide.
armique
New Scratcher
39 posts

Random maze movement

Maybe the way to solve it is using sensor sprites with the ghost effect at 100 (so they are not seen):
http://archive.scratch.mit.edu/forums/viewtopic.php?pid=1141838#p1141838
MrEsch
Scratcher
13 posts

Random maze movement

Thanks for advice, I had them shown when I was programming it - just forgot to hide it!

I will take a look at the ghost idea in the next few weeks and see what happens…watch this space!
armique
New Scratcher
39 posts

Random maze movement

It seems there is a better way to do it: RAYCASTING:

http://wiki.scratch.mit.edu/wiki/Raycaster
MrEsch
Scratcher
13 posts

Random maze movement

I just read it…I just would not know where to start with that!!
drmcw
Scratcher
1000+ posts

Random maze movement

The problem with the pacman script is that you have too many when I receive start blocks. Try and roll them up into just one script. Not only will it run faster but should iron out some of those glitches.
drmcw
Scratcher
1000+ posts

Random maze movement

As a teacher have you looked at ScratchEd? I've seen pacman/maze type games in there which may be of use to you.
curtliom
Scratcher
21 posts

Random maze movement

destiny gif

(twas randomly random)
Itharius
Scratcher
1000+ posts

Random maze movement

I was looking your topic and finally i success myself.
I think you could have a look on my project: Creer un Minotaure https://scratch.mit.edu/projects/80185494/

Thanks
KaiOsmonov
Scratcher
15 posts

Random maze movement

when Pac-Man touches ghost
forever
go to x: (0) y: (0)
end
N8_D_GR8_1
Scratcher
1000+ posts

Random maze movement

KaiOsmonov wrote:

-snip-
Please use the Official scratchblocks Testing Topic if you want to play with the scratchblocks.

Powered by DjangoBB