[Game] Fruits are duplicating
Ninhache opened this issue · comments
If you eat a fruit, it goes to another Tile, but You can still "eat" the previous tile and so grow 2,3,.. 10 times with the "same" fruit.. I would say ghost fruit
Solution found :
class GameObjectFactory {
static createGameObject(map: SnakeMap, item: { x: number, y: number, type: gameObjectType }): Entity {
const tile = new Tile(map, { x: item.x, y: item.y });
// ^^^^
// Do not instanciate a "new Tile", I've to get it from the map as map.getTile(...)
...
}
}