H
H
Hilarion2019-03-14 01:01:46
JavaScript
Hilarion, 2019-03-14 01:01:46

Problem connecting the phaser-spine plugin. What to do?

I recently started getting acquainted with such an engine as phaser. In the process, I found an interesting plugin for animation inside the phaser-spine game https://github.com/orange-games/phaser-spine/tree/... . Plugin downloaded, connected according to the attached instructions. But when trying to load an object into the preload function, problems began. On a command like: game.load.spine('buddy', 'assets/buddy_skeleton.json') gives the following error: spine.js:2874 Uncaught TypeError: Cannot read property 'substring' of undefined
at i.Loader.Phaser.Loader .spine (spine.js:2874).
This line in the plugin code is: basePath: (url.substring(0, url.lastIndexOf('/')) === '') ? '.' : url.substring(0, url.lastIndexOf('/')).
From my own shallow knowledge in js, I concluded that the problem is most likely with access to the specified path. But the reference to the json object seems to be correct. I turned it this way and that, in which the error did not reach. Does anyone have any ideas on this?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
My joy, 2021-10-07
@t-alexashka

Maybe not relevant anymore - but do you run on a domain or just open the file with the game in the browser?
Phaser has a feature that it needs to be run on a server (domain) so that access is like mysite.ru/game for example and not just game.htm
from here there may be problems with paths when they wait for a domain in the path, and not C:\. ..
PS on the toaster very weak support for the phaser community. very few people are involved in game development :(

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question