mcgivrer / mcgivrer/fromClassToGame

TileSet loading

Open
#131 0 comments 0 reactions 1 assignee View on GitHub

@mcgivrer is already working on this.

Since Dec 21, 2021.

documentation enhancement
Dominant language
Java
Stars
1
Forks
1
PR merge metrics
No merged PRs in 30d

Description

Load a TileSet from the level map file to create corresponding Tile's and mapping.

TileSet = Tiles définition picked from an image

A SAmple TileSet class to understand what the challenge is:

class TileSet {
  Map <Code,Tile> tiles
  Image pixelsImage
}

In the level file test-level-tileset.lvl:

{
'name':'test-level-tileset',
'tileSets': [
  { 'id':'t01',
    'name':'myTileSet',
    'pixelsImage':'images/tiles/tiles01.png',
    'tiles':[
      {'code':'b','pos':(0,32),'size':(16,16),attributes:{'block':true}},
      {'code':'o','pos':(32,32),'size':(16,16),attributes:{'collectible':true,'money':5}},
      {'code':'n','pos':(64,0),'size':(16,16),attributes:{'collectible':true,'energy':20}}
    ]
 }]
}

The Use Case is:

Feature: Loading a Level

  The `LevelLoader` service is dedicated to load objects from a level file and initialize all corresponding entities.

  Scenario: 01- loading a TileSet
    Given the LevelLoader is instanciated
    And the level file "test-level-tileset.lvl" is loaded
    Then a level named 'test-level-tileset' is defined
    And a TileSet with 3 Tiles is created
    And the Tile with code 'b' has a 'block' attribute
    And the Tile with code 'o' has a 'collectible' attribute
    And the Tile with code 'n' has a 'collectible' attribute

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.