< Home

Sandwich!

About

Here's my assignment for the end of the Mobile Development module.
Assignment characteristics:
Recreate the original mobile game Sandwich!.

Sandwich! is a casual mobile puzzle game where players stack ingredients to create sandwiches.
The goal is to fold different layers of ingredients in the correct sequence, stacking everything from cheese to vegetables and meats, until a complete sandwich is made.
Simple swipe controls make it easy to fold the ingredients over each other, but careful planning is required to avoid mistakes.

Project Info

clock icon

Team Size: 1

clock icon

Time Frame: 1 weeks

clock icon

Engine: Unity

platform icon

Platform: Android

Game Loop

  1. The GameManager initially loads the PauseState, within which it waits for the player's input to start the game. Additionally, at the game's start (in the Start of LevelLoader), the first level is already instantiated.
  2. Once the player provides the input to start the game, the state transitions to PlayState.
  3. Entering PlayState enables the SwipesManager, which handles reading player input to move various elements on the game grid.
  4. For each valid move made, the win condition is checked; if satisfied, the state changes to WinState.
  5. Entering WinState disables the SwipesManager and waits for the player to input a command to proceed to the next level.
  6. Once the player inputs the command to advance to the next level, it returns to PlayState.
  7. Upon exiting WinState, the LoadNextLevel event is triggered. In this event, the LevelLoader loads the new level (using LevelGenerator to generate random levels whenever it's triggered), and all elements of the previous level's grid self-destruct.
Communication between the various classes is primarily managed through static event Actions.

Stack Animation

Definition: from = stack to be rotated (Target Stack);
Definition: to = stack that receives from.
Definition: stackCount = height of the stack.

There are three possible animation cases for a Stack:

  • stackCount_from == stackCount_to;
  • stackCount_from < stackCount_to;
  • stackCount_from > stackCount_to.
Graphic illustration of the three cases mentioned above:

img

The StacksAnimator is the class responsible for calculating the Starting Point, Ending Point, and Rotation Pivot, and performing the movement of the Target Stack using a classic state pattern after calculating the necessary data.


Try WebGL Version

Switch to a PC to try the web version of the game, or download the APK with the button below if you are on Android