Jump to content

Create player in one file and props in another


elad
 Share

Recommended Posts

Is there a way to create sprite from multiple files ? 

Like creating a sprite : Knight in 'knight.js'

and creating his movement in 'movement.js'

is this possible :

 


// knight.js

import Phaser from 'phaser'
import Movement from './movement'

export default class extends Phaser.Sprite {
    constructor ({ game, x, y, asset }) {
    super(game, x, y, asset)
 }
  movement(){
    // Here Ill call Movement 
  }
}


// movement.js
import Phaser from 'phaser'

export default class extends Phaser.Sprite {
  
  // Here ill make a function that will move the sprite
  // and start the animation
}

 

Link to comment
Share on other sites

  • elad changed the title to Create player in one file and props in another

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