Discuss Scratch

JonFry23
Scratcher
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!

dracae
Scratcher
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!
andre_rifaut
Scratcher
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.
mitchboy
Scratcher
1000+ posts

PAC-MAN Scratch Project: Two sprites interacting to change the costume of a third sprite

JonFry23 wrote:

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 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:

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
Scratcher
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
Scratcher
100+ posts

PAC-MAN Scratch Project: Two sprites interacting to change the costume of a third sprite

TheCrafter01 wrote:

I wish I could help, but the blocks thing here in the forums is hard.
Like I said on the other topic, DO NOT NECROPOST.

Reporting for closure.
NanoRook
Scratcher
1000+ posts

PAC-MAN Scratch Project: Two sprites interacting to change the costume of a third sprite

cs395875 wrote:

TheCrafter01 wrote:

I wish I could help, but the blocks thing here in the forums is hard.
Like I said on the other topic, DO NOT NECROPOST.

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
Scratcher
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
Scratcher
1000+ posts

PAC-MAN Scratch Project: Two sprites interacting to change the costume of a third sprite

NanoRook wrote:

cs395875 wrote:

TheCrafter01 wrote:

I wish I could help, but the blocks thing here in the forums is hard.
Like I said on the other topic, DO NOT NECROPOST.

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.
The question was answered.
Three years!
Reporting for closure

Powered by DjangoBB