generated from bitDecayGames/haxeflixel-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
first pass of break scoring / combos
- Loading branch information
1 parent
458e596
commit 75f70d7
Showing
2 changed files
with
85 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
package matching; | ||
|
||
import flixel.math.FlxMath; | ||
|
||
class Scoring { | ||
|
||
// score based on number of pieces connected together upon break | ||
private static var baseBreakScore = [ | ||
4 => 10, | ||
5 => 15, | ||
6 => 20, | ||
7 => 30, | ||
8 => 40, | ||
9 => 50, | ||
10 => 60, | ||
11 => 70, | ||
12 => 100, // this is theoretically the largest break you can form (I think...) | ||
]; | ||
|
||
// muliplier based on number of breaks combo'd together without dropping new pieces into the board | ||
private static var comboMultiplier = [ | ||
1 => 1, | ||
2 => 1.2, | ||
3 => 1.5, | ||
4 => 2, | ||
5 => 3, // max combo multiplier | ||
]; | ||
|
||
/* multiplier based on making multiple breaks at the same time | ||
* Example mutibreak '2': | ||
* |a|b| | ||
* | | ||
* V | ||
* |a|a|a| |b|b|b| | ||
*/ | ||
private static var multibreakMultiplier = [ | ||
1 => 1, | ||
2 => 1.1, | ||
3 => 1.2, | ||
4 => 1.5, // max multibreak multiplier (do we want this?) | ||
]; | ||
|
||
public static function baseScore(n:Int):Int { | ||
return baseBreakScore.get(Std.int(FlxMath.bound(n, 4, 12))); | ||
} | ||
|
||
public static function comboScalar(n:Int) { | ||
return comboMultiplier.get(Std.int(FlxMath.bound(n, 1, 5))); | ||
} | ||
|
||
public static function multiBreakScalar(n:Int) { | ||
return multibreakMultiplier.get(Std.int(FlxMath.bound(n, 1, 4))); | ||
} | ||
} |