Jump to content

My "sprite" doesn't show it's given texture


dvdkwak
 Share

Recommended Posts

I have made an external file with a class which extends on phaser's Sprite class.

Now I gave it a texture (texture works on normal phaser sprites) but this texture won't show on screen within my project.

Anyone out there who can help me out?

 

 

The Town.scene.js file is the scene which I use.

The NPC file is the own made Phaser Sprite Object

The Sprite class is the file I extends the NPC object on.

Town.scene.js

NPC.js

Sprite.class.js

Link to comment
Share on other sites

After some research I came to a post with the following codepen:

https://codepen.io/samme/pen/jpaBOR

(Thank you samme) :D

I learned to use the function add.existing to add my objects made from the Phaser.Class method to my scene.

Doing it this way somehow does make use of the given Texture.

 

Still my Question remains, why didn't my other option work?

Link to comment
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.

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