Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- onClipEvent (load) {
- lastx = 0;
- lasty = 0;
- }
- onClipEvent (enterFrame) {
- if (Key.isDown(Key.RIGHT)) {
- this._x++;
- } else {
- if (Key.isDown(Key.LEFT)) {
- this._x--;
- }
- }
- if (Key.isDown(Key.UP)) {
- this._y--;
- } else {
- if (Key.isDown(Key.DOWN)) {
- this._y++;
- }
- }
- if (_root.ground.hitTest(this._x, this._y, true)) {
- //trace("touched!");
- this._x = lastx;
- this._y = lasty;
- }
- lastx = this._x;
- lasty = this._y;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement