Jump to content

Help with simple code with ES6 and phaser 3


cpu_sam
 Share

Recommended Posts

Hello,

so, I was here reading and reading and reading and studying codes a lot and I can't resolve a simple problem: how to make a little example with Phaser 3.
when I try to import Phaser as a module with the command: import * as Phaser from "./phaser3.8.0.js"; It gives me the follow error:

Quote

SyntaxError: import declarations may only appear at top level of a module

But the import is already on top level of main module. Or even if I try to import my Player classe with the following:

import Player from "./myPlayer.js";

Where myPlayer.js is the class file with a extends of Player with Phaser.GameObjects.Sprite.

 

Link to comment
Share on other sites

  • 5 months later...

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.

Guest
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.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...