Simple shooter with tanks

[fieldsofexplode.netlify.app]
(https://fieldsofexplode.netlify.app)

Controls on pc - w,a,s,d and arrows. Controls on mobile - swipes

4 Likes

Hi @ARAMONIS and welcome to the forum!
I tried the app but I can’t move. wasd or arrow keys didn’t change anything.

Thanks for the feedback. Strangely, everything worked on my computer. I’ll try to fix it

1 Like

I think i fixed it

1 Like

Is it still the same link? Because if so, then I’m still unable to move. Of course, my poor knowledge of your language doesn’t help with the understanding of the controls :wink:
Did you enter the keyCode or just the character?
Try this:

scene.onKeyboardObservable.add((kbInfo) => {
  switch (kbInfo.type) {
  //on key press
  case BABYLON.KeyboardEventTypes.KEYDOWN:
      switch (kbInfo.event.key) {
        case "w":
        case "W":
        case 87:
        console.log ("forward");
        break
        case "s":
        case "S":
        case 83:
        console.log ("backward");
        break
        case 65:
        case "a":
        case "A":
        console.log ("left");
        break  
        case 68:
        case "d":
        case "D":
        console.log ("right");
        break 
      }
    break;
  }
});
1 Like

The editor did not save the changes :sweat_smile: Updated again.
I’ve always used “event.keyCode”, but it turned out that this is an outdated method.

1 Like

Still the same link? Now the GUI is gone and I cannot start the game.