Assistance with Movement please

Can someone please help me with this very simple game I have been trying to put together. I’m stuck on getting the players to move, no not move an animate, just simply moving. I’ve spent the last 3 days researching and reading other tutorials but just not getting it. I would like to have just a 2D button, that would trigger a function, but I’m having problems understanding that. If I got that correlation, the understanding will help me. Here is my project.
I’m new to all of this so I’m not sure how to post correctly. Thanks in advance if you do help, literally spent 3 days on this.

Hi @Jason_Owens and welcome,

You can start by studying the following movement tutorial:

Your scripts are set to a right start, you just need to implement input handlers. So movement happens only when there is user input.

1 Like

Thank you for your prompt reply. I think I was just need rest because this morning I woke up, watched a few more videos, and I saw your message and I was able to put together this. I may need to start over from the multiplayer boilerplate, as right now, I’m just wanting to get 2 players (which will ultimately have units of 4 each) to connect to each other and me be able to manipulate movement on one side, while being able to view it on the other connected machine. Sorry for giving you all this info now, but basically I’m taking the game Parchessi, and making my own version. This is my original game, but it’s 2D and we only can play on 1 touchscreen (still fun). My Game

Now that I at least have movement, you can see it now and get a better idea on what I’m going with. You can move by pressing the up arrow, and the player hops around the mapped out board. I will now start to add my tweens animations.

Thanks again for your help, and welcoming me to the community.

1 Like

Before I go too far down this rabbit hole, and design this the wrong way and wish I had asked first, let me just do that. Do you know of a simple way to move/tween between 2, vec3s? I’m using the UP key for now to cycle through my vec positions, and on my old game that’s how it was, very choppy, but functional. I’m more concerned about the multiplayer functionality more than anything else and can forego adding animated walking if it’s going to be too cumbersome. But I’d like to think since I have 2 distance vectors, I could tween by getting the distance. But I’m doing that in the update function and therefore it just keeps incrementing.

Hi @Jason_Owens,

You could take a look at the Playcanvas Tween library if you just want to move an object arbitrarily between points:

Thanks, sorry, I’m still new to all of this. I’ll book mark this page since it seems logical to check there first.

No problem! Asking is the first step to learning, and the Tween library isn’t available in a new project by default, so it can be easy to miss.

I feel I may be using this tween library incorrectly. I’ve downloaded and copied it to my scripts folder, but it’s not available in my Add Scripts Component. After checking other projects all today and searching through videos, I can’t see to figure out as to why it’s not available. Thanks in advance.

Hi @Jason_Owens,

The tween library isn’t like a normal script. It just has to reside in your project folders and you can call its functions within the scripts of scene objects. (eg. this.entity.tween() )

Does this look correct? If I run the commented line beneath, it will advance without a problem. The thing is, I’m not getting an error either?

// update code called every frame
Network.prototype.update = function (dt) {   
    var app =;
    if (app.keyboard.isPressed(pc.KEY_UP)) {
        this.player.tween(this.player.getLocalPosition()).to({x: 9.5, y: 0.5, z: -1}, 1, pc.SineOut);
        //this.player.setPosition(yellowX[x += 1], 0.5, yellowZ[z += 1]);
        this.updatePosition ();

Looks like I forgot to put it in a variable and add…


Thanks again!