params.gd 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. class_name Params
  2. ## Game tuning values, ported from the cocos2d-x params.h.
  3. # Ball
  4. const BALL_RADIUS := 15.0
  5. const THROW_ANGLE := 20.0 # degrees either side of straight up
  6. const INITIAL_SPEED := 500.0
  7. const BALL_BOUNCE := 1.005 # every bounce speeds the ball up a little
  8. const BALL_GRAVITY := 250.0 # px/s², pulls sideways-bouncing balls back to the paddle
  9. # Core
  10. const CORE_RADIUS := 50.0
  11. # Paddle
  12. const PADDLE_WIDTH := 120.0
  13. const PADDLE_HEIGHT := 10.0
  14. const PADDLE_ALTITUDE := 90.0 # distance from the bottom of the screen
  15. const PADDLE_MAX_ANGLE := 60.0 # degrees from vertical when the ball leaves the paddle's tip
  16. const PADDLE_CLEARANCE := 6.0 * 2.0 * BALL_RADIUS # min space between the outer ring and the paddle
  17. const RING_SIZE := CORE_RADIUS * 0.75 # ring thickness when there is room for it
  18. const HIGHEST_CORE := 0.36 # the core moves up to this fraction of the screen height to make room
  19. # Colors
  20. const COLOR_PINK := Color("#f92672")
  21. const COLOR_BLUE := Color("#66d9ef")
  22. const COLOR_GREEN := Color("#a6e22e")
  23. const COLOR_ORANGE := Color("#fd971f")
  24. const COLOR_GREY := Color("#787878")
  25. const COLOR_RED := Color(0.988, 0.147, 0.030)
  26. const COLOR_FIRE := Color("#ff5a1f")
  27. const COLOR_BACK := Color("#272822")
  28. const COLOR_BOMB := Color("#4a4a44")
  29. # Physics layers (bit values)
  30. const LAYER_WALLS := 1
  31. const LAYER_PADDLE := 2
  32. const LAYER_BLOCKS := 4
  33. const LAYER_BALLS := 8
  34. const LAYER_POWER_UPS := 16
  35. # Power-ups. Every POWER_UP_INTERVAL seconds a drop is rolled (power_up_chance), and the
  36. # kind is picked by the weights in PowerUp.KINDS. Triple balls roll separately.
  37. const DROP_TRIPLE_BALL := 0.06 # multiplied by seconds since a ball last touched anything
  38. const SAVE_DELAY := 10.0 # seconds into a level before "save" can drop
  39. const POWER_UP_INTERVAL := 2.5
  40. const POWER_UP_PADDLE_SECONDS := 10.0
  41. const SLOW_SCALE := 0.6
  42. const SLOW_SECONDS := 8.0
  43. const RUSH_SCALE := 1.35
  44. const RUSH_SECONDS := 6.0
  45. const CATCH_SECONDS := 12.0
  46. const CATCH_HOLD_SECONDS := 2.0 # a caught ball leaves by itself after this
  47. const SHIELD_CHARGES := 1
  48. const BIG_BALL_SECONDS := 10.0
  49. const FIREBALL_SECONDS := 5.0
  50. const LASER_SECONDS := 6.0
  51. const FREEZE_SECONDS := 8.0
  52. const BOMB_RADIUS := 90.0
  53. const HOMING_SECONDS := 6.0
  54. # Hours without playing before the saved level drops by one
  55. const LOSE_HOURS := 12
  56. # Text
  57. const MSG_TRIPLE_BALLS := "Triple Balls!"
  58. const MSG_LEVEL_SAVED := "Level Saved!"
  59. const MSG_OVER := "Game Over..."
  60. const MSG_DOUBLE_PADDLE := "Doubled paddle!"
  61. const MSG_HALF_PADDLE := "Half paddle :("
  62. const MSG_LEVEL_BACK := "You are at level %d. Play within %.1f hour(s) or you will drop back a level."
  63. const MSG_NEXT_LEVEL := "Next Level"
  64. const MSG_RESTART := "Restart"
  65. const MSG_SUPER_BALL := "Super Ball!"
  66. const MSG_SLOW := "Slow motion"
  67. const MSG_CATCH := "Catch! Lift your finger to throw"
  68. const MSG_SHIELD := "Shield!"
  69. const MSG_SHIELD_USED := "Shield saved you!"
  70. const MSG_BIG_BALL := "Big ball!"
  71. const MSG_FIREBALL := "Fireball!"
  72. const MSG_RUSH := "Rush! :("
  73. const MSG_LASER := "Lasers!"
  74. const MSG_FREEZE := "Rings frozen"
  75. const MSG_BOMB := "Bomb ball!"
  76. const MSG_HOMING := "Homing ball!"
  77. # Progression: how the game gets harder level by level. Every curve only goes up.
  78. const MAX_RINGS := 14
  79. ## Rings around the core: 1 at level 0, 3 at level 12, 6 at 75, 10 at 243, 14 from 507.
  80. static func ring_count(level: int) -> int:
  81. return mini(MAX_RINGS, 1 + int(sqrt(level / 3.0)))
  82. ## Share of segments that are indestructible.
  83. static func indestructible_chance(level: int) -> float:
  84. return minf(0.3, level * 0.004)
  85. ## Bounces and speed-ups stop at this speed, in px/s.
  86. static func max_ball_speed(level: int) -> float:
  87. return 850.0 + minf(150.0, level * 0.3)
  88. ## Fastest a ring can turn, in degrees per second.
  89. static func ring_speed(level: int) -> float:
  90. return 30.0 + minf(40.0, level * 0.25)
  91. ## Launch speed of a new ball.
  92. static func launch_speed(level: int) -> float:
  93. return INITIAL_SPEED + minf(150.0, level * 1.0)
  94. ## Share of segments that are a special kind (water, ice, ...), once one has unlocked.
  95. static func special_segment_share(level: int) -> float:
  96. if level < 50:
  97. return 0.0
  98. return minf(0.5, 0.08 + (level - 50) * 0.0012)
  99. ## Chance of a power-up drop every POWER_UP_INTERVAL seconds.
  100. static func power_up_chance(level: int) -> float:
  101. return 0.12 + minf(0.06, level * 0.0006)
  102. ## Multiplier on power-down weights: they get likelier as the levels go up.
  103. static func power_down_factor(level: int) -> float:
  104. return 1.0 + minf(2.0, level / 100.0)