Skip to content

Determine texture variants on the server #28

@sn3p

Description

@sn3p

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 ...
  ]
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingquestionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions