i want to make a Game but i have no code for it
i want to make a 2D combat game
hello i can help with the keys code or wasd code
hear if(key === “up”){
}
this .y -=10
make sure there is no space in the this.y part and it is in the brackets.
this is the way I would do it. put this in the update tab of the player.
if(isKeyDown("up") {
this.y -= 10;
}
1 Like
oh ok thanks
it made my player move up is there anyway to make it move in every direction
Yes, you can use something like this in the update script:
var number=13; // Set speed here
if(isKeyDown('right')){
this.x+=number;
}
if(isKeyDown('left')){
this.x-=number;
}
if(isKeyDown('up')){
this.y-=number;
}
if(isKeyDown('down')){
this.y+=number;
}
ok i put it in
but i want to make it have combat physics
yes what i needed thanks
Welcome to the forums!