forking from https://gitea.daggertrout.com/mcdoh/ExMineArchive
This commit is contained in:
35
lib/ex_mine/tile.ex
Normal file
35
lib/ex_mine/tile.ex
Normal file
@@ -0,0 +1,35 @@
|
||||
defmodule ExMine.Tile do
|
||||
|
||||
defstruct(
|
||||
color: %{
|
||||
red: 0,
|
||||
green: 0,
|
||||
blue: 0,
|
||||
|
||||
alpha: 1.0,
|
||||
},
|
||||
|
||||
mine: nil,
|
||||
flag: false,
|
||||
scale: 1.0,
|
||||
unveiled: false,
|
||||
update: -1,
|
||||
neighboring_mines: nil
|
||||
)
|
||||
|
||||
def new_tile(game, _x, _y) do
|
||||
%__MODULE__{
|
||||
color: %{
|
||||
red: :rand.uniform(128) + 128,
|
||||
green: :rand.uniform(128) + 128,
|
||||
blue: :rand.uniform(128) + 128,
|
||||
|
||||
alpha: (:rand.uniform(20) + 75) / 100,
|
||||
},
|
||||
|
||||
mine: :rand.uniform() <= game.mine_density,
|
||||
|
||||
scale: (:rand.uniform(20) + 70) / 100,
|
||||
}
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user