Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Errors: "Unresolved slope type 'r' / Slope type r not defined", "tilemapLayer.getTileOffsetX is not a function" #54

Open
SHG42 opened this issue Apr 20, 2020 · 4 comments

Comments

@SHG42
Copy link

SHG42 commented Apr 20, 2020

I'm trying to set up a basic Phaser CE project with the arcade-slopes plugin. I have a Phaser 3 project where I'm handling sloped platforms with MatterJS, but Arcade has some methods that would be very useful for this project, so I want to compare slope-handling in CE with the plugin to slope-handling in Phaser 3 with Matter.

I'm running the bare-bones Webpack template from the Phaser CE repo and I'm running the project with node through VS Code. I used the provided arcadeslopes tileset and followed the instructions on the main repo page for the plugin for setting up.

I have run into these two issues, and I'm not sure if it's a bug or just me making novice mistakes, LOL. (I've been learning Phaser3 for about half a year, and this is my first time using CE.)

  • "tilemapLayer.getTileOffsetX is not a function" : this error occurs when setting up a collider between the player sprite and the platform. It goes away if I comment out any lines of code related to the plugin.
  • "Unresolved slope type 'r' / Slope type r not defined" : this error occurs with or without the collider, it goes away if I comment out any lines of code related to the plugin.

Here are screenshots of the dev tools console, and you can view the complete source code at this Drive folder.

With plugin-related lines of code commented out
With no collider
With collider
Could you please enlighten me as to what's going wrong here?

@hexus
Copy link
Owner

hexus commented May 3, 2020

Hi! Thanks for reaching out.

At first glance of your error stack traces, I would assume it's caused by one of the following:

  • Tiled's tilemap data format has changed
  • The plugin is no longer compatible with the most recent versions of Phaser CE
  • The slope map has been registered with the plugin incorrectly

Without having looked at your code yet, I'd suggest trying to run your project with earlier versions of Phaser CE to see if it works. That would help you or I narrow it down. If it works in 2.10.x, for example, then it's likely an issue with your code, as that was the last version I tested the plugin with.

Hopefully I'll get some time to inspect your code, get it running, and figure out what's going wrong here.

@hexus hexus self-assigned this May 3, 2020
@SHG42
Copy link
Author

SHG42 commented May 14, 2020

Hi, thanks for the reply! I managed to resolve this by switching from using phaser-arcade-slopes.min.js to using the regular phaser-arcade-slopes.js file, and that worked. I had already installed Phaser CE 2.10 before installing the plugin, as I'd noticed that the compatibility chart ended there, so I was definitely having this issue with 2.10.x installed. My code worked as expected without needing any further modifications once I switched the js file. As to why switching the js file resolved the issue... well, that's beyond the scope of my experience as a coder, so I'll leave that up to you! I would be curious to know what happened, though, if you get a chance to look into it.

@hexus
Copy link
Owner

hexus commented May 14, 2020

Oh, interesting! So the minified version is the only one that causes a problem, without changing anything else? I'm pretty much just passing it through uglify, so that surprises me. Maybe uglify needs updating.

Indeed the compatibility chart ends at 2.10.x, but may well support some later versions okay. I simply haven't tested them. 😄 Mostly using Phaser 3 these days.

@SHG42
Copy link
Author

SHG42 commented May 15, 2020

Yep, it does seem that the minified file was causing the problem, which was very surprising to me as well. I had been going over my code with a fine-toothed comb trying to find mistakes, and I decided on a whim to try switching the files, and you can imagine my surprise when that did the trick.

Yeah, I had originally started this project in Phaser 3 (I just started learning Phaser last year, so I started with 3). Hadn't planned on needing to use CE, but I really wanted to use your plugin, LOL. I had been handling slopes with Matter and it was just not providing the results I wanted. I was actually quite shocked when I found out that Arcade doesn't handle slopes natively!

@hexus hexus removed their assignment May 18, 2020
@hexus hexus mentioned this issue Aug 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants