U3L17 Interactive Card

My student wants to make the donut look as though it is being eaten with each mouse click. I have another student who has the same idea for ice cream. Any suggestions.

@tfrederick2,

Something like this looks like it could work, but I can’t tell for sure without access to the actual project since this code doesn’t show me what the sprites look like.

Can you possibly find the “share” button and copy the link so we can look at the actual project?

thanks,

Mike

So, are they trying to take a new bit every time it is clicked?

They could continue doing what they have done here, but add multiple images showing a new bite taken out each time if that’s what they are after.

Right now, the single bite seems to work pretty well. Is there something they are trying that isn’t working?

Mike

The other images are a different piece of the donut missing each time. The first one (donutbite1) worked, but the second (donutbite2) did not work.

She wanted a new animation with each mouse click and when the donut is gone a text message will appear.

Ok. I understand now.

I would probably start by simplifying a few things.

You only need one sprite (donut). It will change costumes depending on how many times it is clicked.

This way, you don’t have to hide and unhide different sprites. You just change the costume of the sprite you have.

Then, there are probably a number of different approaches. I would probably create a variable called “clicks” at the beginning of the program and set it to zero.

I would also probably change the name of the original donut image to “donutbite0” as that will allow you to take advantage of a naming trick to change the costumes (see below). The + sign adds the number of clicks to the end of the animation name and then the drawSprites block draws the correct costume.

Screen Shot 2023-05-15 at 1.16.21 PM

So then, they would want to create a conditional that displays text if the value of clicks hits 5, ELSE, it adds one to the value of clicks if the mouse button is clicked.

I hope these hints are enough to get them started, but I could see a few other potential glitches that could come up, so feel free to check back in if they run into other issues or can’t get this pseudocode to work.

Mike

THANK YOU. That helps tremendously! This student is one of my “stars” who finds enjoys the work and I want her to have her vision come to life.

I will keep you posted and send another link when it is finished this week.

1 Like