Jump to content

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


Recommended Posts

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


Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...