Cannot read property 'startSystem' of undefined

Recommended Posts

Hi !

I have a problem when i want to import this line :


and i have this error

game.js:32 Uncaught TypeError: Cannot read property 'startSystem' of undefined

my main.js is that :

var game = new Phaser.Game( {
  type: Phaser.AUTO, // Which renderer to use
  width: 500, // Canvas width in pixels
  height: 500, // Canvas height in pixels
  parent: "game-container", // ID of the DOM element to add the canvas to
  scene: {
    preload: preload,
    create: create,
    update: update
  physics: {
    default: "arcade",
    arcade: {
      gravity: {
        y: 0
      } // Top down game, so no gravity

let player;

function preload() {
  this.load.image("perso", "../assets/images/perso.png");
  this.load.image("tiles", "../assets/tilesets/atlas.png");
  this.load.tilemapTiledJSON("map", "../assets/tilemaps/map.json");

function create() {
  const map = this.make.tilemap({
    key: "map"

  // Parameters are the name you gave the tileset in Tiled and then the key of the tileset image in
  // Phaser's cache (i.e. the name you used in preload)
  const tileset = map.addTilesetImage("atlas", "tiles");

  // Parameters: layer name (or index) from Tiled, tileset, x, y
  const fond = map.createStaticLayer("fond", tileset, 0, 0);
  const worldLayer = map.createStaticLayer("element", tileset, 0, 0);

  worldLayer.setCollisionBetween(12, 44);
    collides: true
  const debugGraphics =;
  const spawnPoint = map.findObject("Objects", obj => === "spawnPoint");
  player = this.physics.add.sprite(spawnPoint.x, spawnPoint.y, "perso");

  const spawnPointM = map.findObject("ObjectsPosM", obj => === "spawnPointM");
  monster = this.physics.add.sprite(spawnPointM.x, spawnPointM.y, "perso");

  this.physics.add.collider(player, worldLayer);

  this.cameras.main.startFollow(player, true, 0.08, 0.08);


function update(time, delta) {

  var speed = 300
  // Stop any previous movement from the last frame
  cursors = this.input.keyboard.createCursorKeys()

  // Horizontal movement
  if (cursors.left.isDown) {
  } else if (cursors.right.isDown) {

  // Vertical movement
  if (cursors.up.isDown) {
  } else if (cursors.down.isDown) {

  // Normalize and scale the velocity so that player can't move faster along a diagonal

Im sorry if my english is bad, im a french student...

Share this post

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    No registered users viewing this page.