[RESOLVED] Gravity and Ground hitTest
Alright, so I am working on a smooth gravity script, with multiple grounds, so far it was working pretty well, until i tried to add in a second ground MC, here was my code for the gravity section at first, it worked fine :
onClipEvent (enterFrame) {
if ((this.frontleg.hitTest (_root.ground.topg)) && (this._y -= 0)) {
this._y += 0;
if (this.frontleg.leg._currentframe == 15) {
this.frontleg.gotoAndStop (1);
this.backleg.gotoAndStop (1);
this.frontarm.gotoAndStop (1);
this.backarm.gotoAndStop (1);
}
if (Key.isDown (Key.UP)) {
_root.knight.frontleg.gotoAndStop (3);
_root.knight.backleg.gotoAndStop (3);
_root.knight.frontarm.gotoAndStop (3);
_root.knight.backarm.gotoAndStop (3);
}
}else{
if (this.frontleg._currentframe == 3) {
}else{
this._y += 8;
}
}
if (this.torso.hitTest (_root.ground.leftg)) {
this._x -= 9;
}
if (this.torso.hitTest (_root.ground.rightg)) {
this._x += 9;
}
if (this.knighthead.hitTest (_root.ground.bottomg)) {
_root.knight.frontleg.lj.gotoAndStop (15);
_root.knight.backleg.lj.gotoAndStop (15);
}
}
Then I tried to add this and neither of the grounds would work anymore :
onClipEvent (enterFrame) {
if ((this.frontleg.hitTest (_root.ground1.topg)) && (this._y -= 0)) {
this._y += 0;
if (this.frontleg.leg._currentframe == 15) {
this.frontleg.gotoAndStop (1);
this.backleg.gotoAndStop (1);
this.frontarm.gotoAndStop (1);
this.backarm.gotoAndStop (1);
}
if (Key.isDown (Key.UP)) {
_root.knight.frontleg.gotoAndStop (3);
_root.knight.backleg.gotoAndStop (3);
_root.knight.frontarm.gotoAndStop (3);
_root.knight.backarm.gotoAndStop (3);
}
}else{
if (this.frontleg._currentframe == 3) {
}else{
this._y += 8;
}
}
if (this.torso.hitTest (_root.ground1.leftg)) {
this._x -= 9;
}
if (this.torso.hitTest (_root.ground1.rightg)) {
this._x += 9;
}
if (this.knighthead.hitTest (_root.ground1.bottomg)) {
_root.knight.frontleg.lj.gotoAndStop (15);
_root.knight.backleg.lj.gotoAndStop (15);
}
}
Any Idea what happened?
Bump, anyone have an idea what I`m doing wrong?
Prid - Outing
17 Years old boy, who loves the Computer Technology
BRING BACK THE OLD DESIGN!! OR AT LEAST FIX THE AS TAGS
Posting Permissions
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
Forum Rules
Click Here to Expand Forum to Full Width