Mobile player movement

Hey. I made ui scene with controll-buttons. for example : when left button is pointerdown i send “moveLeft” event, when pointerup i send “stopMove” event.
In player class i made eventlistenner method. Inside this method i wrote this:
EventManager.on(“moveLeft”,()=>{
this.direction =" left";
});

Then, in player update method i wrote this:
switch(this.direction)
case “left” :
this.player.setVelocityX(-speed);

And etc
In scene update method i call player update method.

So my question is : Are there better options?

If you have a problem or glitch with the solution I gave, remember these wise words, THE ORDER OF YOUR CODE MATTERS!!! (also if you dont like the player moving diagonally then make two separate boxes for going up and down and left and right or add one box for left and right then add a jump button)

THIS IS VERY LONG I KNOW BUT I PROMISE IT WILL SOLVE YOUR PROBLEM! (also will not work unless button is a sprite and the box should be an image but you ca do what you want with the box)I have a wonderfull idea and it will work like roblox mobile does if that would work for your kind of game.(if u havent played roblox mobile go play it with default movement; not dynamic). So, lets say that there is a box that starts from x positions 0-50 and y positions 400-350. (this would be great for default phaser game size). make a button that could move with the mouse or pointer. then make sure that the button would always stay in the box. For example, to make sure that the button could never go off the top edge do this if (button.y < 350 - the number that is half the button height) {
button.y = 350 - the number that is half of the button height} so then we could split that box into sections. if the button is in the top half of the box then the players y velocity will decrease making it go up and if it is not half of the box then it will go down. this is what the code would look like if (button.y < 375) { player.setVelocityY(-100) } else { player.setVelocityY(100) }. Do something simmilar with the x axis and we are almost done! now all we need to do is make sure that the player is able to stop. For this, we will make a variable. you can name it whatever you like but i will name it fingerDown. give this the value of zero. now put all of the code you just did and put it in an if statement like this. if (fingerDown == 1) { all the code we just did }. then make the finger down equal one when the players finger is down (meaning on the button) and make it zero when it is off the button. WE DID IT YAY!!!

I understand what you are saying, and I think that this is a very good and effective way to create mobile controls, but it would help if you could maybe send the relevant code to us so we could better help you