Page 1 of 1

2D Movement

PostPosted: Mon Mar 30, 2015 9:20 pm
by silverplanetside
This is the first thing I wanted to try with this engine and after losing 8 hours of my life my character still moves in 2.5D.

This code in ServerNetworkEvents.js will allow me to move in 2D (up, left, down, right), but I'm sure it's not the most elegant solution, and I go crazy just by thinking how many conditionals would I need to move in 2D diagonal too.



Code: Select all
   _onPlayerLeftDown: function (data, clientId) {
      ige.server.players[clientId].playerControl.controls.left = true;
   ige.server.players[clientId].playerControl.controls.down = true;
   },

   _onPlayerLeftUp: function (data, clientId) {
      ige.server.players[clientId].playerControl.controls.left = false;
   ige.server.players[clientId].playerControl.controls.down = false;
   },

   _onPlayerRightDown: function (data, clientId) {
      ige.server.players[clientId].playerControl.controls.right = true;
   ige.server.players[clientId].playerControl.controls.up = true;
   },

   _onPlayerRightUp: function (data, clientId) {
      ige.server.players[clientId].playerControl.controls.right = false;
   ige.server.players[clientId].playerControl.controls.up = false;
   },

   _onPlayerUpDown: function (data, clientId) {
      ige.server.players[clientId].playerControl.controls.up = true;
   

   ige.server.players[clientId].playerControl.controls.left = true;
   },

   _onPlayerUpUp: function (data, clientId) {
   ige.server.players[clientId].playerControl.controls.up = false;
      
   ige.server.players[clientId].playerControl.controls.left= false;



   },
   
   _onPlayerDownDown: function (data, clientId) {
      ige.server.players[clientId].playerControl.controls.right = true;
      ige.server.players[clientId].playerControl.controls.down = true;
   },

   _onPlayerDownUp: function (data, clientId) {
      ige.server.players[clientId].playerControl.controls.right = false;
      ige.server.players[clientId].playerControl.controls.down = false;

   }
};


I've messed with every file placed in "24.4-multiplayer-isometric-keyboard" taking references of "9.3-goto-2d-tiles" mostly to draw the map. Wish there was a "multiplayer-NONisometric-keyboard" folder.

Re: 2D Movement

PostPosted: Tue Mar 31, 2015 11:09 pm
by robaldred
Hello
Have you tried removing this.isometric(true) from Character.js in the example?
I'll try and help and get you a multiplayer non iso tomorrow for you