Jump to content

The problem with moving


DigitalHilsone
 Share

Recommended Posts

Guys, please help to deal with the movement of the model (car). I wrote some code, but it is not working. Point me in the right direction.

var Control = (function () {    function Control() {        this.c = 0;    }    Control.prototype.keyUp = function (key) {        switch (key) {            case 39:                Control.moveLeft = false;                break;            case 38:                Control.moveForward = false;                break;            case 37:                Control.moveRight = false;                break;            case 40:                Control.moveBackward = false;                break;        }    };    Control.prototype.keyDown = function (key) {        switch (key) {            case 39:                Control.moveLeft = true;                break;            case 38:                Control.moveForward = true;                break;            case 37:                Control.moveRight = true;                break;            case 40:                Control.moveBackward = true;                break;            case 68:                if (this.c % 2 == 0) {                    Control.driftMode = true;                } else {                    Control.driftMode = false;                }                this.c++;                break;        }    };    Control.moveForward = false;    Control.moveBackward = false;    Control.moveLeft = false;    Control.moveRight = false;    Control.driftMode = false;    return Control;})();
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...