Tweaked difficulty a bit more & transfered lives to next level.

This commit is contained in:
Sander Schobers 2021-08-09 12:13:20 +02:00
parent 7321cf3c9d
commit ad8a540af2
2 changed files with 6 additions and 2 deletions

View File

@ -23,9 +23,13 @@ func (app *appContext) Play(ctx ui.Context) {
func (app *appContext) PlayNext(ctx ui.Context, controller *levelController) {
difficulty := controller.Level.Difficulty
score := controller.Level.Score
lives := controller.Level.Lives
level := tins2021.NewLevel()
level.Randomize(difficulty+1, numberOfStars)
level.Score = score
level.Lives = lives
controller.Play(level)
}

View File

@ -154,7 +154,7 @@ func (l *Level) Randomize(difficulty int, stars int) {
l.Tiles[pos].Star = true
stars--
}
hearts := 1 + (80-difficulty)*4/80 // [5..0]
hearts := 1 + (100-difficulty)/50 // [3..1] (only difficulty has 3 hearts)
for hearts > 0 {
i := rand.Intn(len(positions))
pos := positions[i]
@ -164,7 +164,7 @@ func (l *Level) Randomize(difficulty int, stars int) {
l.Tiles[pos].Heart = true
hearts--
}
monsters := 2 + (6 * difficulty / 100)
monsters := 2 + (8 * difficulty / 100)
minRandomMonster := (100-difficulty)*80/100 + 10 // [90..10]
minChaserMonster := (100-difficulty)*50/100 + 50 // [100..50]
for monsters > 0 {