Design and Implementation of Labyrinth Game in App Inventor

App Inventor 24-06-25
27 0

Tutorial plan

1- Presentation of labyrinth game

2- Objective of our mobile application

3- Description of Designer Interface

4- Description of Blocks part

 

 

Presentation of labyrinth game

The Labyrinth game is a classic puzzle game in which the player must navigate a character or object through a complex maze to reach a goal or exit point. The player must avoid obstacles, follow the correct path, and sometimes collect items or solve challenges along the way. The game tests spatial reasoning, problem-solving, and hand-eye coordination.

In this project, the Labyrinth game is developed using MIT App Inventor, a visual programming platform for building Android applications. The game uses a tilt-based control system (using the phone's accelerometer sensor) to move a ball or character through the maze. The walls of the maze are represented visually, and the game detects collisions between the ball and the walls or the goal.

 

Objective of our mobile application

The objective of our mobile application is to design and develop an interactive Labyrinth (Maze) game using MIT App Inventor that allows users to navigate a ball through a maze by tilting their smartphone. The game aims to provide an engaging user experience while demonstrating key programming concepts such as sensor integration, collision detection, and event-driven programming.

 

Description of Designer Interface

The Designer interface in MIT App Inventor is where we arrange and configure the visual and non-visual components of the Labyrinth game. It defines how the game looks and how users interact with it on their smartphone screens.

To organize the elements on the screen:

- Screen1: The main screen where the game takes place.

- HorizontalArrangement / VerticalArrangement (optional): Used to align labels, buttons, or other interface elements like reset or score.

Visual Components :

These are visible to the user:

Canvas:

A large rectangular area where the labyrinth is drawn.

The main playground where the ball (player) moves.

Dimensions are set to fill most of the screen.

ImageSprites:

BallSprite: Represents the player. A small circle or ball image that moves with the phone's tilt.

WallSprites: Invisible or image-based barriers placed inside the Canvas to form the maze.

Buttons :

To move the player (ball) through the maze manually, you can add four directional buttons on the screen:

- ButtonUp  moves the ball upward

- ButtonDown moves the ball downward

- ButtonLeft moves the ball left

- ButtonRight moves the ball right

 

Description of Blocks part

The Blocks part of our application in MIT App Inventor defines the behavior of the Labyrinth game. It contains the logic that allows the player (ball sprite) to move, detect collisions with walls, and trigger winning or losing messages.

These blocks are arranged using a visual programming language, making it easy to control the game's flow without writing traditional code.

Explanation of Each Block 

Block

Role

This block triggers an action immediately when the user touches (presses down) on the "Up" button, before they release it.

This block is used in MIT App Inventor to move a sprite (Ball1) on the Canvas to a new position.

This block is used in MIT App Inventor to change the up direction the sprite is "facing" or moving toward on the Canvas.

This block is used in MIT App Inventor to set how fast the sprite (Ball1) moves when using the Move block.

This block in MIT App Inventor is triggered as soon as the user touches and holds the Down button.

This block is used in MIT App Inventor to move the sprite (Ball1) upward on the canvas by 1 pixel.

This block sets the down direction (or facing angle) of the Ball1 sprite on a Canvas in MIT App Inventor.

This block is triggered in MIT App Inventor when the user lifts their finger off the UpButton after pressing it. It's often used to stop a continuous action that was started in TouchDown.

This block is used in MIT App Inventor to stop the movement of the sprite Ball1 when using the Move block.

This block is triggered immediately when the user touches and holds down the Right button on the screen.

This block is used in MIT App Inventor to move the sprite Ball1 one pixel to the right on the canvas.

This block in MIT App Inventor sets the direction (heading) of the sprite Ball1 on a Canvas.

This block triggers as soon as the user touches and holds the Left button on the screen. It’s used to start moving the sprite to the left.

This block moves the sprite Ball1 one pixel to the left on the canvas.

This block in MIT App Inventor sets the direction (Left) of the sprite Ball1 on a Canvas.

This block is triggered in MIT App Inventor when the user lifts their finger off the RightButton after pressing it. It's commonly used to stop any continuous rightward movement that began when the button was touched (TouchDown).

This block is triggered when the user lifts their finger off the Left button after pressing it. It's commonly used to stop any ongoing action that was started in the TouchDown event.

This block in MIT App Inventor is triggered when the sprite Ball1 touches or collides with another ImageSprite on the Canvas. It is commonly used in games to detect collisions with walls, goals, enemies, or other obstacles.

This block sets the horizontal position (X-coordinate) of the sprite Ball1 on the Canvas to a specific value.

This block sets the vertical position (Y-coordinate) of the sprite Ball1 on the Canvas to a specific value.

0 comment

Leave a comment

Veuillez noter s'il vous plaît*

Votre adresse e-mail ne sera pas publiée. Les champs obligatoires sont indiqués avec *

Purpose of this website

Educational robotics refers to the use of robots and robotics technology to promote learning in educational settings. It involves the integration of technology, engineering, and computer science into the classroom, allowing students to engage in hands-on, project-based learning experiences.
In this context, our website represents an excellent resource for parents, teachers and children who wish to discover robotics.

Contact details

Zaouiet Kontech-Jemmel-Monastir-Tunisia

+216 92 886 231

medaliprof@gmail.com

Pictures of the articles

Robotic site created by MedAli-Teacher info