Bey blade 2d Battle simulator

🎉 Winner: {{ winner.name }} 🎉

Leaderboard

  1. {{ p.name }} - ❤ {{ p.health }} - ⚙ {{ Math.round(p.rpm) }} rpm- ⚙ 0 rpm {{ p.name }} - 🏆 1st Place 🥈 2nd Place 🥉 3rd Place {{ p.place }}th Place

About

This is a 2D battle simulator inspired by the Beyblade franchise. It uses HTML5 canvas to render the arena and JavaScript to handle the game logic. Keywords: Beyblade, 2D, battle simulator, HTML5, canvas, JavaScript.

How to play

Enter the names of the players in the textarea. After clicking "Start", the players will be pitted against each other in an automated battle. The winner will be announced at the end. Nothing needs to be done during the battle, just watch and enjoy!

Power ups

  • Blood: Blood is the red bar that appears when a player's health falls below 50%. The blood bar fills up as the player takes damage, and when the blood bar is full, the player is eliminated from the battle.
  • Collisions: Collisions occur when two or more players are within a certain distance of each other. When a collision occurs, the players involved take damage proportional to their speed and mass.
  • Power ups: Power ups are special items that randomly spawn on the arena. When a player collects a power up, they gain a temporary advantage over the other players. The following power ups can spawn:
    • Health: Restores a set amount of health to the player.
    • Shield: Gives the player a temporary shield that absorbs a set amount of damage.
    • Speed: Increases the player's speed for a short duration.

Game phisics

The game's physics are based on simple collision detection and basic kinematics. When two or more players collide, the players involved take damage proportional to their speed and mass. The players' positions and velocities are updated every frame using the following equations:

  • position = previous position + velocity * time step
  • velocity = previous velocity + acceleration * time step
The game also uses a simple bounding box collision detection algorithm. When two players' bounding boxes overlap, the game checks if the distance between the centers of the two players is less than or equal to the sum of their radii. If the distance is less than or equal to the sum of the radii, the game triggers a collision event.