Sign in to follow this  
elad

one character multiple code files

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
}

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.