3-Phase Game Project Completed – Phase 3 Bugs Crashing Everything (Sounds, Collisions, Timer Issues)

Hi everyone,

I've been building a game in MIT App Inventor and completed it in three phases. The first two phases worked fine, but after implementing Phase 3, everything broke. I'm hoping someone can help me debug this.

Project Overview:

It's a simple platform/endless runner-style game where a player sprite moves left/right on platforms, collects coins, avoids obstacles, and progresses to the next level.

Phase 1 – UI & Basic Setup:

Built the entire user interface.

Set up sprite positioning (defined where each sprite should appear on the screen).

Added a random background generator so the background changes each time.

Phase 2 – Core Mechanics (Working Fine):

Adjusted platform movement speed.

Platforms move upward; when they reach the top of the screen, they respawn from roughly the middle and continue moving up until they disappear off-screen.

When the user clicks/taps the screen, the player sprite changes direction (left/right).

The player should NOT move unless there's a platform directly beneath it (gravity/collision detection active).

Implemented a Restart button that resets the entire game to the initial state.

Phase 3 – New Features (THIS IS WHERE ALL BUGS STARTED):

I added the following features, but they're causing major issues:

Game Over Conditions:

If the player hits the top sprite (ceiling) OR falls into the water, the game should:

Show a "You Lost!" message.

Play a losing sound effect.

Stop ALL game movement (freeze everything).

Coin Collection:

If the player touches a coin sprite, they should gain +10 points.

Next Level Trigger:

If the player touches the "Next Level" sprite, the game should:

Pause for a few seconds.

Then restart automatically.

I'm using a Clock/Timer component for this delay.

The Problems I'm Facing (All in Phase 3):

:cross_mark: All dialogs/sounds play simultaneously – When one event triggers, everything else fires at the exact same time (e.g., losing sound plays while coin sound also plays, and Next Level triggers all together).

:cross_mark: Game declares "You Lost" before it even starts – As soon as the app loads, the losing condition triggers immediately without any player input.

:cross_mark: Collision detection is completely unreliable – Sometimes collisions register, sometimes they don't. The player sometimes clips through platforms.

:cross_mark: Timer/Clock issues – The pause before restarting doesn't work correctly; sometimes it freezes permanently, other times it restarts too quickly.

:cross_mark: Multiple events stacking – If the player touches a coin and a spike at the same time, both events fire, causing conflicting results (e.g., gain points AND lose at the same time).

:cross_mark: Restart button doesn't fully reset Phase 3 features – After restarting, the new features (sound, timer, next level) still have leftover values from the previous round.

What I've Tried So Far:

Checked all collision blocks (they seem correctly connected).

Added "Notifier" blocks to track variable values – they show correct numbers, but the logic still fails.

Tried separating events with "if-else" conditions, but they still overlap.

Verified all sprite names and component references.

My Specific Questions:

How can I make sure only ONE event (e.g., losing OR coin) fires at a time, instead of all of them together?

Why does the "You Lost" condition trigger at startup? How do I prevent game logic from running before the player actually interacts?

What's the correct way to pause the game for a few seconds using a Clock/Timer without freezing the whole app?

How do I properly reset ALL variables and timers when the Restart button is pressed?

What I Need Help With:

I'm attaching:

Screenshots of my blocks (Phase 3 logic especially).

My .aia file (if anyone wants to open it directly).

If anyone has experience with sprite collisions, timer delays, or preventing event overlap in App Inventor, I'd really appreciate your guidance. I'm stuck and have been trying to fix this for days.

Thank you so much in advance for your time!

P

Clever_Fox_3.aia (1.6 MB)

.S. I'm happy to share more details or explain any part of the code. Just let me know what you need.

It's going to be a while before I can open your project, so here's some general advice.

Leave all timers disabled in the Designer. Use the Enabled property, not the Always Fires property. (It took me a while to figure that one out)

Sprites should also be left disabled until needed, to avoid premature event activation.

Sprite sizes should be limited to avoid premature collision.

Use the Player component for sounds, and take advantage of its completion event to trigger the next sound off of a temporary queue (list) of sounds to be played.

Avoid the Sound component. It locks things up while playing.

Read the Sprite Cannibalism articles in the Canvas FAQ

http://www.appinventor.org/book2
(Chapter 17)

Nice… for some reason as the program starts the player collides with “some random sprites” ( a few or even all ), added a small initial delay in which collision are disabled.

Clever_Fox_3a.aia (1.6 MB)

I looked at your sprites and their sizes.

All sprites are set to automatic sizes, and were left enabled.
The Canvas is set tp Fill Parent in a responsive sizing scheme.

So everything is left to chance as to collisions.

Here are the image sizes, from the assets 7zip subfolder of your aia file, extracted to a Windows folder and extra columns turned on to show image dimensions:

I recommend reviewing them to assure they make sense together.