PhaserJS 2.4 released with integrated Creature support!

Discuss issues pertaining to the various game/web runtimes of Creature here.
chong
Posts: 1178
Joined: Thu Feb 19, 2015 2:21 am

Re: PhaserJS 2.4 released with integrated Creature support!

Post by chong » Mon Apr 24, 2017 4:58 pm

Hello,

No problem :) I am the author and creator of Creature. Thanks again for supporting the tool!

Cheers

zampano
Posts: 70
Joined: Wed Jun 07, 2017 3:37 pm

Re: PhaserJS 2.4 released with integrated Creature support!

Post by zampano » Thu Jun 08, 2017 8:31 pm

I am having serious trouble getting my first test animation to work with phaser. I tried it using both the Creature documentation as well as this example: https://phaser.io/examples/v2/animation/creature-dragon

I followed the steps and loaded the required files and get all kinds off errors depending on the approach. I am using phaser 2.8 and I think this might be a problem.

@abutkus I would be interested in your solution

Any other help is very much appreciated also. :(

chong
Posts: 1178
Joined: Thu Feb 19, 2015 2:21 am

Re: PhaserJS 2.4 released with integrated Creature support!

Post by chong » Thu Jun 08, 2017 9:35 pm

Hello,

What errors are you experiencing? What is the error printout you are getting?
Can you grab the runtimes from GitHub and try it out with the sample:
https://github.com/kestrelm/Creature_We ... -Demo.html

You will need to swap out the json files with any examples you have ( there are some from GitHub itself ).

Thanks

zampano
Posts: 70
Joined: Wed Jun 07, 2017 3:37 pm

Re: PhaserJS 2.4 released with integrated Creature support!

Post by zampano » Fri Jun 09, 2017 7:33 am

The Demo works out of the box, but when I exchange the phaser version with the current one, I get this:

Code: Select all

Uncaught TypeError: PIXI.Texture.fromImage is not a function
Id be interested to hear if abutkus is using a plain phaser build or is it a custom one. Also I am wondering about the example on the phaser website where the code is much more straight-forward than in the creature docs. Why is that and which one is best to use?

chong
Posts: 1178
Joined: Thu Feb 19, 2015 2:21 am

Re: PhaserJS 2.4 released with integrated Creature support!

Post by chong » Fri Jun 09, 2017 3:32 pm

Hello,

So:

Code: Select all

PIXI.Texture.fromImage 
Is a function that loads an image as a texture into Pixi's WebGL framework. Phaser in V2 variants uses the PIXI framework to load textures. As far as I can tell, this is the standard way to do it. The error you are experiencing is more of a general Phaser question: How do I load a texture into Phaser? If that function does not exist ( which is strange ), I wonder if they removed it or it is called something else.

You might want to try asking this more general question on the Phaser forums. If you find out a different answer ( as in it should be done a different way ), please let me know and I will update the code to load textures differently.

The code on the Phaser website is simpler because they did quite a bit of work to simplify the API. You can try theirs first since it hides a lot of the more complex operations from you. If you need more power/flexibility, use the one on the Creature GitHub page.

Cheers

zampano
Posts: 70
Joined: Wed Jun 07, 2017 3:37 pm

Re: PhaserJS 2.4 released with integrated Creature support!

Post by zampano » Fri Jun 09, 2017 3:53 pm

Thank you for the explanation, I thought so too. I think the direct access to pixi is not possible anymore, but wasn't able to find an alternate function yet. I have already posted on the phaser forums and I'm hopibg to get help there. I will inform you as soon as I got it working!

chong
Posts: 1178
Joined: Thu Feb 19, 2015 2:21 am

Re: PhaserJS 2.4 released with integrated Creature support!

Post by chong » Fri Jun 09, 2017 5:37 pm

Hello,

Actually I am looking at Phaser's Creature implementation here:
https://github.com/photonstorm/phaser/b ... reature.js

It does look like they are still accessing Pixi, including Pixi texture. So maybe all you need to ask is how to access those functions as well from your own code. Once that is solved, it should fix most of your issues.

Cheers

zampano
Posts: 70
Joined: Wed Jun 07, 2017 3:37 pm

Re: PhaserJS 2.4 released with integrated Creature support!

Post by zampano » Mon Jun 12, 2017 6:00 pm

Hey there!

I got it working now, after asking in this thread:
http://www.html5gamedevs.com/topic/2861 ... nstructor/

I am using phasers implementation, it was a matter of importing the ride files. However, it's possible to access the creature manager via CREATURE.manager, and I am encountering more problems with seemingly deprecated or buggy code there.

- For one, isPlaying never goes back to false after being set to true once, regardless if the animation is finished.

- there was a typo of some sort in line 7228 of creature.js, this here:

Code: Select all

for(var i = 0; i < target_creature.total_num_pts * 3; i++)
It needs to be "this.target_creature..."

- I am trying to use the blend function as described in the docs, but I get this error after fixing the previous point:
"Uncaught TypeError: this.blend_render_pts.set is not a function" in Line 7233 of creature.js, whích is this one:

Code: Select all

this.blend_render_pts.set(0, new_vec);
EDIT:
Also, the version of creature.js in the phaser ce seems to be slightly different (and longer) than the one I got from the creature website, even though they've got the same version number in their header.

chong
Posts: 1178
Joined: Thu Feb 19, 2015 2:21 am

Re: PhaserJS 2.4 released with integrated Creature support!

Post by chong » Mon Jun 12, 2017 6:45 pm

Hello,

Sorry yes that looks like a syntax bug. We are trying to add a new vector/point into an empty array.
Can you try something like this instead:

Code: Select all

this.blend_render_pts.push(new_vec);
If that works, I will patch it in later.

Cheers

zampano
Posts: 70
Joined: Wed Jun 07, 2017 3:37 pm

Re: PhaserJS 2.4 released with integrated Creature support!

Post by zampano » Mon Jun 12, 2017 7:04 pm

Seems to work, but there's more errors. Had to change "blending_factor" to this.blending_factor in lines 7196 and 7197 and there's another "set" instead of push in 7195.

Now I've got no more errors but it doesn't seem like there's anything more happening than that the animation just stops for some reason, even though I'm changing the BlendingFactor over time.

Post Reply