hexus / phaser-arcade-slopes

:triangular_ruler: A Phaser CE plugin that brings sloped tile collision handling to the Arcade Physics engine
MIT License
126 stars 16 forks source link

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

Open SHG42 opened 4 years ago

SHG42 commented 4 years ago

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

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 commented 4 years ago

Hi! Thanks for reaching out.

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

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.

SHG42 commented 4 years ago

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 commented 4 years ago

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 commented 4 years ago

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!