Making an Image appear for 1sec after CollideWith Event

I'm teaching App Inventor using PLTW's App Creator class. Our students are doing the project where they make their own app for the first time. One of the choices is a game where a water balloon is flung at a target.

One of my more advanced groups has completed the project early and is looking for ways to make their app better. They want to make a splash image appear when you hit the target, stay visible for a second, then disappear.

I realize they need to use the clock feature and to make the imagesprite visible probably through a procedure, but I'm getting a little bogged down because I don't see any similar examples when I search.

Here is their code so far:

This is what their UI looks like:

Here is their project file if needed:
BishopMoveFast2.aia (255.3 KB)

Here are the basics

canvasSplash.aia (14.9 KB)

Canvas Touch event generates the splash. Select the desired event for your app.

I looked at that code and tested it with the companion, but I'm not sure how that relates to the collidewith event. When you are moving the water balloon, you will touch the canvas, which would seem to trigger your event. But we only want the image to appear when the water balloon collides the target.

I was imagining making a procedure that triggers a clock for the splash image to turn on and off and putting that procedure in the collideswith event handler when it collides with the targetsprite. I'm just confused how to put that into motion.

Here is my take based on the given code.

Since there is already a Clock Timer running, I use that to evaporate (make not .Visible) the Splash Sprite, regardless of its status.

The Splash Sprite has to start out invisible.

Since the splash sprite is invisible most of the time, it can't be collided with.
So the only collision event will still be just balloon on target.
When that happens, make the splash sprite visible and on the target. (I am a little off, give or take sprite width.) I do that before the target jumps to its new location.

AT the top of the Clock Timer I set the splash sprite invisible.

These blocks can be dragged from the board into the Blocks Editor.

as an example:

Thank you everyone for your input. My students ended up using the second option and it worked.


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.