Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Determine texture variants on the server #28

Open
sn3p opened this issue Apr 15, 2019 · 0 comments
Open

Determine texture variants on the server #28

sn3p opened this issue Apr 15, 2019 · 0 comments
Labels
bug Something isn't working question Further information is requested

Comments

@sn3p
Copy link
Collaborator

sn3p commented Apr 15, 2019

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 ...
  ]
}
@sn3p sn3p added bug Something isn't working question Further information is requested labels Apr 15, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working question Further information is requested
Projects
None yet
Development

No branches or pull requests

1 participant