Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » PAC-MAN Scratch Project: Two sprites interacting to change the costume of a third sprite
- JonFry23
-
1 post
PAC-MAN Scratch Project: Two sprites interacting to change the costume of a third sprite
Hello All,
I'm brand new to Scratch, but found myself hooked after playing with it for only a short while last night. I'm building a version of PAC-MAN and have a number of things already in place (e.g., movement of PacMan, Movement of Ghost, pac-dots (large and small), old-school video game board as the backdrop, score counter, etc.). My question is, how do I create a script where PacMan (sprite 1) touches one of the large pac-dots (sprite 2) and it changes the costume of one (or more) of my Ghost (sprite 3) (e.g., from light blue to navy blue). Is something like this possible, and if so, what would be the proper set up?
Many thanks in advance for your help!
I'm brand new to Scratch, but found myself hooked after playing with it for only a short while last night. I'm building a version of PAC-MAN and have a number of things already in place (e.g., movement of PacMan, Movement of Ghost, pac-dots (large and small), old-school video game board as the backdrop, score counter, etc.). My question is, how do I create a script where PacMan (sprite 1) touches one of the large pac-dots (sprite 2) and it changes the costume of one (or more) of my Ghost (sprite 3) (e.g., from light blue to navy blue). Is something like this possible, and if so, what would be the proper set up?
Many thanks in advance for your help!
- dracae
-
1000+ posts
PAC-MAN Scratch Project: Two sprites interacting to change the costume of a third sprite
I would love to help, but I unfortunately have to go to bed… D:
I'll try to help tomorrow morning, unless someone else help you out before I can.
Anyways, I apologize, but good night!
I'll try to help tomorrow morning, unless someone else help you out before I can.

Anyways, I apologize, but good night!

- andre_rifaut
-
100+ posts
PAC-MAN Scratch Project: Two sprites interacting to change the costume of a third sprite
When sprite1 touches sprite2, send a message.
Sprite3 will get the message and can do something such as change the color effect.
Sprite3 will get the message and can do something such as change the color effect.
- mitchboy
-
1000+ posts
PAC-MAN Scratch Project: Two sprites interacting to change the costume of a third sprite
I had this in my Pac-man prototype, so I can help you out. Create a variable (doesn't matter what it's called, just something you know what it means) for all sprites. Drag an ‘if’ and a ‘set variable’ block onto either the Pac-man or large pac-dot script area. Put a <touching Sprite2?> block in the space after the ‘if’, then put the ‘set variable’ block inside the ‘if’ block and change the number to 1. Then add a ‘wait’ and another ‘set variable’ block beneath the other ‘set variable’ block. (this is so the ghost doesn't change back right away after Pac-man eats the dot) Then for the ghost, drag an ‘if’ block onto the script area. Put a <(variable name)=1> block in the ‘if’ block, then put a ‘switch costume’ block inside it. This is what the scripts should look like: Hello All,
I'm brand new to Scratch, but found myself hooked after playing with it for only a short while last night. I'm building a version of PAC-MAN and have a number of things already in place (e.g., movement of PacMan, Movement of Ghost, pac-dots (large and small), old-school video game board as the backdrop, score counter, etc.). My question is, how do I create a script where PacMan (sprite 1) touches one of the large pac-dots (sprite 2) and it changes the costume of one (or more) of my Ghost (sprite 3) (e.g., from light blue to navy blue). Is something like this possible, and if so, what would be the proper set up?
Many thanks in advance for your help!
Pac-man/Large Pac-dot
| if <touching Sprite2?>|
| ||set (variable name) to (1)|
| ||wait (amount) secs|
| ||set (variable name) to (0)|
Ghost:
| if <(variable name)=1>|
| ||switch costume to [pac-dot eaten|
Last edited by mitchboy (May 16, 2013 21:42:08)
- TheCrafter01
-
1 post
PAC-MAN Scratch Project: Two sprites interacting to change the costume of a third sprite
I wish I could help, but the blocks thing here in the forums is hard.
Last edited by TheCrafter01 (July 1, 2016 01:41:20)
- cs395875
-
100+ posts
PAC-MAN Scratch Project: Two sprites interacting to change the costume of a third sprite
Like I said on the other topic, DO NOT NECROPOST. I wish I could help, but the blocks thing here in the forums is hard.
Reporting for closure.

- NanoRook
-
1000+ posts
PAC-MAN Scratch Project: Two sprites interacting to change the costume of a third sprite
Like I said on the other topic, DO NOT NECROPOST. I wish I could help, but the blocks thing here in the forums is hard.
Reporting for closure.
The question was never resolved, therefore it cannot be closed.
Also, pretty sure this topic isn't that old, please stop acting like you know everything.
- Greatguy123
-
500+ posts
PAC-MAN Scratch Project: Two sprites interacting to change the costume of a third sprite
I'd consider 2013 pretty old. If JonFry23 didn't figure it out, he probably gave up by now. Maybe he just didn't respond.
- asivi
-
1000+ posts
PAC-MAN Scratch Project: Two sprites interacting to change the costume of a third sprite
The question was answered.Like I said on the other topic, DO NOT NECROPOST. I wish I could help, but the blocks thing here in the forums is hard.
Reporting for closure.
The question was never resolved, therefore it cannot be closed.
Also, pretty sure this topic isn't that old, please stop acting like you know everything.
Three years!
Reporting for closure
- Discussion Forums
- » Help with Scripts
-
» PAC-MAN Scratch Project: Two sprites interacting to change the costume of a third sprite