GitHub Documentation Patreon donate button

Colyseus Schema: A map with multiple types



  • Is it possible to create a map with multiple types? For example in Typescript you can do something like this:

    tiles = new Array < Tile | Gate > ();

    You have an array of with Tiles and Gates but as of now, it's not synched with the schema. I can add only one type @type({map: Tile}). How do I write @type with multiple classes e.g. Tile and Gate without creating a separate map for each?


  • administrator

    Hi @virtumonde, the @colyseus/schema supports inheritance, if the Gate extends Tile it should work as expected!

    Hope this helps, cheers!



  • @endel Thank you, I am aware of this. As I understand @colyseus/schema doesn't support multiple classes, right?


 

GitHub Documentation Patreon donate button

© 2020 Endel Dreyer