At the moment the grass texture variant is based on a random number. The problem with this approach is that the texture changes while walking.
https://github.com/fatboypunk/BearNecessities/blob/6eef3deb0b4549098ce88ea7b414385602946e13/apps/bear_necessities_web/lib/bear_necessities_web/views/playfield.ex#L7
So we somehow want to determine and store the texture state on the server, for example as %Grass{texture: 2} and %Tree{texture: 4}.
This also means that tiles can have multiple layers, for example:
[
%Grass{texture: 2},
%Tree{texture: 4}
]
Thoughts on this?
Would something like this make sense?
%Game{
field: [
# row 1 (11 tiles)
[
%Tile{layers: [%Grass{texture: 2}]},
%Tile{layers: [
%Grass{texture: 2},
%Bear{}
]},
%Tile{id: 3, layers: [%Grass{texture: 4}]},
# ...
],
# row 2 (11 tiles)
[
%Tile{layers: [%Grass{texture: 3}]},
%Tile{layers: [%Grass{texture: 2}]},
%Tile{layers: [
%Grass{texture: 1}
%Tree{texture: 3}
]},
# ...
]
# 9 more rows ...
]
}
At the moment the grass texture variant is based on a random number. The problem with this approach is that the texture changes while walking.
https://github.com/fatboypunk/BearNecessities/blob/6eef3deb0b4549098ce88ea7b414385602946e13/apps/bear_necessities_web/lib/bear_necessities_web/views/playfield.ex#L7
So we somehow want to determine and store the texture state on the server, for example as
%Grass{texture: 2}and%Tree{texture: 4}.This also means that tiles can have multiple layers, for example:
Thoughts on this?
Would something like this make sense?