class_name Params ## Game tuning values, ported from the cocos2d-x params.h. # Ball const BALL_RADIUS := 15.0 const THROW_ANGLE := 20.0 # degrees either side of straight up const INITIAL_SPEED := 500.0 const BALL_BOUNCE := 1.005 # every bounce speeds the ball up a little const BALL_GRAVITY := 250.0 # px/s², pulls sideways-bouncing balls back to the paddle # Core const CORE_RADIUS := 50.0 # Paddle const PADDLE_WIDTH := 120.0 const PADDLE_HEIGHT := 10.0 const PADDLE_ALTITUDE := 90.0 # distance from the bottom of the screen const PADDLE_MAX_ANGLE := 60.0 # degrees from vertical when the ball leaves the paddle's tip const PADDLE_CLEARANCE := 6.0 * 2.0 * BALL_RADIUS # min space between the outer ring and the paddle const RING_SIZE := CORE_RADIUS * 0.75 # ring thickness when there is room for it const HIGHEST_CORE := 0.36 # the core moves up to this fraction of the screen height to make room # Colors const COLOR_PINK := Color("#f92672") const COLOR_BLUE := Color("#66d9ef") const COLOR_GREEN := Color("#a6e22e") const COLOR_ORANGE := Color("#fd971f") const COLOR_GREY := Color("#787878") const COLOR_RED := Color(0.988, 0.147, 0.030) const COLOR_FIRE := Color("#ff5a1f") const COLOR_BACK := Color("#272822") const COLOR_BOMB := Color("#4a4a44") # Physics layers (bit values) const LAYER_WALLS := 1 const LAYER_PADDLE := 2 const LAYER_BLOCKS := 4 const LAYER_BALLS := 8 const LAYER_POWER_UPS := 16 # Power-ups. Every POWER_UP_INTERVAL seconds a drop is rolled (power_up_chance), and the # kind is picked by the weights in PowerUp.KINDS. Triple balls roll separately. const DROP_TRIPLE_BALL := 0.06 # multiplied by seconds since a ball last touched anything const POWER_UP_INTERVAL := 2.5 const POWER_UP_PADDLE_SECONDS := 10.0 const SLOW_SCALE := 0.6 const SLOW_SECONDS := 8.0 const RUSH_SCALE := 1.35 const RUSH_SECONDS := 6.0 const CATCH_SECONDS := 12.0 const CATCH_HOLD_SECONDS := 2.0 # a caught ball leaves by itself after this const SHIELD_CHARGES := 1 const BIG_BALL_SECONDS := 10.0 const FIREBALL_SECONDS := 5.0 const LASER_SECONDS := 6.0 const FREEZE_SECONDS := 8.0 const BOMB_RADIUS := 90.0 const HOMING_SECONDS := 6.0 # Core pull: as segments run out, the core draws nearby balls in so levels don't drag. const CORE_PULL := 450.0 # px/s² when every breakable segment is gone const CORE_PULL_REACH := 120.0 # px beyond the outer ring # Score: points per break, times a combo multiplier that grows with breaks in a row # (without the ball touching the paddle). const POINTS_PER_BREAK := 10 const BREAKS_PER_COMBO_STEP := 3 const MAX_COMBO := 5 # Feel const SHAKE_MAX := 14.0 # px at full trauma const SHAKE_DECAY := 1.6 # trauma lost per second # Hours without playing before the saved level drops by one const LOSE_HOURS := 12 # Text const MSG_TRIPLE_BALLS := "Triple Balls!" const MSG_OVER := "Game Over..." const MSG_DOUBLE_PADDLE := "Doubled paddle!" const MSG_HALF_PADDLE := "Half paddle :(" const MSG_LEVEL_BACK := "You are at level %d. Play within %.1f hour(s) or you will drop back a level." const MSG_NEXT_LEVEL := "Next Level" const MSG_LEVEL_DONE := "Level %d complete" const MSG_RESTART := "Restart" const MSG_SUPER_BALL := "Super Ball!" const MSG_SLOW := "Slow motion" const MSG_CATCH := "Catch! Lift your finger to throw" const MSG_SHIELD := "Shield!" const MSG_SHIELD_USED := "Shield saved you!" const MSG_BIG_BALL := "Big ball!" const MSG_FIREBALL := "Fireball!" const MSG_RUSH := "Rush! :(" const MSG_LASER := "Lasers!" const MSG_FREEZE := "Rings frozen" const MSG_BOMB := "Bomb ball!" const MSG_HOMING := "Homing ball!" # Progression: how the game gets harder level by level. Every curve only goes up. const MAX_RINGS := 14 const FIRST_SPECIAL_LEVEL := 15 # water arrives here; the rest every 50 levels after ## Rings around the core: 1 at level 0, 3 at level 12, 6 at 75, 10 at 243, 14 from 507. static func ring_count(level: int) -> int: return mini(MAX_RINGS, 1 + int(sqrt(level / 3.0))) ## Share of segments that are indestructible. static func indestructible_chance(level: int) -> float: return minf(0.3, level * 0.004) ## Bounces and speed-ups stop at this speed, in px/s. static func max_ball_speed(level: int) -> float: return 850.0 + minf(150.0, level * 0.3) ## Fastest a ring can turn, in degrees per second. static func ring_speed(level: int) -> float: return 30.0 + minf(40.0, level * 0.25) ## Launch speed of a new ball. static func launch_speed(level: int) -> float: return INITIAL_SPEED + minf(150.0, level * 1.0) ## Share of segments that are a special kind (water, ice, ...), once the first has unlocked. static func special_segment_share(level: int) -> float: if level < FIRST_SPECIAL_LEVEL: return 0.0 return minf(0.5, 0.06 + (level - FIRST_SPECIAL_LEVEL) * 0.0012) ## Seconds to win a level within for three stars; twice that for two. static func par_seconds(level: int) -> float: return 60.0 + minf(60.0, level * 0.8) ## Chance of a power-up drop every POWER_UP_INTERVAL seconds. static func power_up_chance(level: int) -> float: return 0.12 + minf(0.06, level * 0.0006) ## Multiplier on power-down weights: they get likelier as the levels go up. static func power_down_factor(level: int) -> float: return 1.0 + minf(2.0, level / 100.0)