Calculate correct delay for pro game
This commit is contained in:
parent
8c8c44053a
commit
bb0b4bbf19
5 changed files with 6015 additions and 7 deletions
6001
Score-delay chart.fods
Normal file
6001
Score-delay chart.fods
Normal file
File diff suppressed because it is too large
Load diff
|
@ -52,9 +52,6 @@ config :ex_speed_game,
|
||||||
# Delay at start of game between ticks, in milliseconds.
|
# Delay at start of game between ticks, in milliseconds.
|
||||||
delay_start: 570,
|
delay_start: 570,
|
||||||
|
|
||||||
# Delay at start of pro game
|
|
||||||
delay_pro: 321,
|
|
||||||
|
|
||||||
# Score at start of pro game
|
# Score at start of pro game
|
||||||
score_pro: 100,
|
score_pro: 100,
|
||||||
|
|
||||||
|
|
|
@ -11,16 +11,19 @@ defmodule ExSpeedGame.Game.Menu do
|
||||||
|
|
||||||
alias ExSpeedGame.PubSub
|
alias ExSpeedGame.PubSub
|
||||||
|
|
||||||
|
@initial_delay Application.compile_env!(:ex_speed_game, :delay_start)
|
||||||
|
@pro_score Application.compile_env!(:ex_speed_game, :score_pro)
|
||||||
|
|
||||||
@menu {
|
@menu {
|
||||||
{"SpeedGame", Speed,
|
{"SpeedGame", Speed,
|
||||||
%Speed.Options{
|
%Speed.Options{
|
||||||
initial_score: 0,
|
initial_score: 0,
|
||||||
initial_delay: Application.get_env(:ex_speed_game, :delay_start)
|
initial_delay: @initial_delay
|
||||||
}},
|
}},
|
||||||
{"SpeedGame Pro", Speed,
|
{"SpeedGame Pro", Speed,
|
||||||
%Speed.Options{
|
%Speed.Options{
|
||||||
initial_score: Application.get_env(:ex_speed_game, :score_pro),
|
initial_score: @pro_score,
|
||||||
initial_delay: Application.get_env(:ex_speed_game, :delay_pro)
|
initial_delay: Speed.get_delay_at(@pro_score, @initial_delay)
|
||||||
}},
|
}},
|
||||||
{"MemoryGame", Speed, %{}},
|
{"MemoryGame", Speed, %{}},
|
||||||
{"Show IP", ShowIP, %{}},
|
{"Show IP", ShowIP, %{}},
|
||||||
|
|
|
@ -128,6 +128,13 @@ defmodule ExSpeedGame.Game.Modes.Speed do
|
||||||
ButtonInput.release(ButtonInput)
|
ButtonInput.release(ButtonInput)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@spec get_delay_at(integer(), float()) :: float()
|
||||||
|
def get_delay_at(score, initial_delay) do
|
||||||
|
for _i <- 1..score, reduce: initial_delay do
|
||||||
|
acc -> get_next_delay(acc)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
@spec schedule_tick(float()) :: float()
|
@spec schedule_tick(float()) :: float()
|
||||||
defp schedule_tick(delay) do
|
defp schedule_tick(delay) do
|
||||||
Process.send_after(self(), :tick, trunc(delay))
|
Process.send_after(self(), :tick, trunc(delay))
|
||||||
|
|
2
mix.exs
2
mix.exs
|
@ -2,7 +2,7 @@ defmodule ExSpeedGame.MixProject do
|
||||||
use Mix.Project
|
use Mix.Project
|
||||||
|
|
||||||
@app :ex_speed_game
|
@app :ex_speed_game
|
||||||
@version "0.3.0"
|
@version "0.3.1"
|
||||||
@all_targets [:rpi0]
|
@all_targets [:rpi0]
|
||||||
|
|
||||||
def project do
|
def project do
|
||||||
|
|
Loading…
Reference in a new issue