Quantcast
Channel: 2D Latest Topics
Viewing all articles
Browse latest Browse all 623

"TypeError: Phaser.Physics.Arcade.moveToObject is not a function"

$
0
0

I'm not sure exactly what's going on with that. Every other component I've tried to use seems to be working, except for the other functions in that family. moveToXY gives the same message. I am using Phaser 2.6.2. I might be able to find some other solution, but it would easily be the most ideal. I'm working on a train project featuring a train that needs to move at a constant rate, so I don't want to use the functions that use acceleration.

Here is the line where I call it, but I don't think I'm having a syntax issue:

car.engage = function() {
   car.rotation = Phaser.Physics.Arcade.moveToObject(car, car.destination, car.speed);
}

Any guidance is appreciated.

 

Update: I figured out the problem by looking through the code examples for Arcade physics. Definitely a user error. For anyone else having the problem, it needs to read:

car.engage = function() {
       car.rotation = game.physics.arcade.moveToObject(car, car.destination, car.speed);
}

 


Viewing all articles
Browse latest Browse all 623

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>