Report
Save
Cancel
offline
rino
27 posts
Nomad
Posted July 28, '09 12:35am UTC
I have code (below) that allows the character to move so that it alows it to rotate to the ground, but now I'am try to make him jump but it does not seem to work, if you could please help adjust the code so that the character can jump, it would be alot of help onClipEvent (load) { this.dir = 1; function updateBB () { while (!_root.ground.hitTest (_root.bb._x, _root.bb._y, true)) { _root.bb._y++; } while (_root.ground.hitTest (_root.bb._x, _root.bb._y, true)) { _root.bb._y--; } } } onClipEvent (enterFrame) { if (Key.isDown (Key.RIGHT)) { this._x += 10; this.dir = 1; } if (Key.isDown (Key.LEFT)) { this._x -= 10; this.dir = -1; } while (!_root.ground.hitTest (this._x, this._y, true)) { this._y += 5; } while (_root.ground.hitTest (this._x, this._y, true)) { this._y--; } //see A //_root.cc._y = this._y; _root.bb._x = this._x + (20 * this.dir); _root.bb._y = this._y; updateBB (); rot1 = Math.atan2 (_root.bb._y - this._y, _root.bb._x - this._x); this._rotation = rot1 * 180 / Math.PI; if (this.dir == -1) { this._rotation += 180; } this._xscale = this.dir * Math.abs (this._xscale); updateBB (); }