Cards appear after each wave ends, offering upgrades to tower stats. Learn to create a database-driven approach for tower upgrades with three rarity levels and weighted selection.

Card Rarity System

The system uses three card levels with different drop rates:

  • Minor cards: 77% chance (green color)
  • Major cards: 21% chance (blue color)
  • Giant cards: 1% chance (red color)

Each rarity level contains five upgrade types: gun damage, tower health, tower max health, runner speed, and tower rotational speed. Players have an equal chance of getting any upgrade within the selected rarity.

Upgrade Mechanics

Each card contains a title, description, and upgrade amount. The upgrade amount multiplies current stats. For example, a 1.1 multiplier increases gun damage by 10%, while a 2.0 multiplier doubles it. Adding new cards requires updating the database and adding a condition in the update stats routine.

Watch Tutorial