Algorand Mini-Game

Overview

This is a simple game built with Algorand's Pyteal where a user plays as a warrior fighting a monster boss. This makes use of Pyteal's global and local states to store values that will be used in the game. The player's and the boss' stats are kept at default values at level 1. They both have Health, Attack, and Defense. Once the player defeats a boss, their level will be increased by 1. Every time a player increases levels, they can spend twenty (20) points to add to their stats, while the boss' stats increase steadily with the player's level.

Game Mechanics

Connecting with Pera Algo Wallet

To be able to play, the user needs to connect first using their Pera Algo Wallet by scanning a QR code generated by the dApp.

Opting in

The user also needs to opt-in to the smart contract by pressing the Register button. This will set the initial values of their player stats, including their level which starts at level 1.

Start Battle

Once the player's stats are set up, the boss' stats will be displayed, and also a Fight Boss button which if pressed and confirmed, will set up the boss stats for the specific level and start the battle.

In Battle

While in the battle, the player can pick a type of attack which gives a chance to land a critical hit which deals triple the player's normal damage. The likeliness of critical chance is determined by generating a pseudo-random number on the smart contract by implementing linear congruential recurrence relation and if it matches with the player's selected number, it will deal the critical damage.

If the player misses the critical hit, they can still land a double attack through chance (via a randomly generated number from 1 - 4) that will be passed as an argument to the smart contract. The boss also have the chance to hit a double attack through the same method.

Leveling up

After defeating a boss, the player will enter a state where they can add 20 points to their current stats which they can equally divide among Health, Attack, and Defense based on their preference.

Defeated

Once the player has been defeated by the boss, they can restart the level by pressing the Resurrect button, this will replenish their HP based on their current Health and start the battle again with the current boss.

Demo

Here's a video recording demonstrating the user's interactions with the dApp.

IMAGE ALT TEXT HERE

Here is the demo link hosted in vercel to try it out.