Advertisement
Guest User

Untitled

a guest
Jun 20th, 2017
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. onClipEvent (load) {
  2.     lastx = 0;
  3.     lasty = 0;
  4. }
  5. onClipEvent (enterFrame) {
  6.     if (Key.isDown(Key.RIGHT)) {
  7.         this._x++;
  8.     } else {
  9.         if (Key.isDown(Key.LEFT)) {
  10.             this._x--;
  11.         }
  12.     }
  13.     if (Key.isDown(Key.UP)) {
  14.         this._y--;
  15.     } else {
  16.         if (Key.isDown(Key.DOWN)) {
  17.             this._y++;
  18.         }
  19.     }
  20.     if (_root.ground.hitTest(this._x, this._y, true)) {
  21.         //trace("touched!");
  22.         this._x = lastx;
  23.         this._y = lasty;
  24.     }
  25.     lastx = this._x;
  26.     lasty = this._y;
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement