# Need Help resolving game bugs!

**URL:** <https://forum.kirupa.com/t/need-help-resolving-game-bugs/42400>\
**Category:** Uncategorized\
**Created:** [February 8, 2004, 9:30pm UTC](https://forum.kirupa.com/t/need-help-resolving-game-bugs/42400 "2004-02-08T21:30:28Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![Fargate](https://avatars.discourse-cdn.com/v4/letter/f/dbc845/32.png) [@Fargate](https://forum.kirupa.com/u/Fargate)\
**Post date:** [February 8, 2004, 9:30pm UTC](https://forum.kirupa.com/t/need-help-resolving-game-bugs/42400/1 "2004-02-08T21:30:28Z")

</div>

I’ve created a platformer game. The problem is that sometimes my character rides to high on the platforms as well as too low. He even ends up falling through sometimes. The platforms are all in one mc. Below is the jumping and platform script.

[AS]  
onClipEvent (enterFrame) {  
if (Key.isDown(Key.UP) && !jumping) {  
vel\_y = 36;  
jumping = true;  
}  
if (jumping == true) {  
vel\_y -= 2;  
if (vel\_y\<=-15) {  
vel\_y = -15;  
}  
this.\_y -= vel\_y;  
}  
if (\_root.ground.hitTest(this.\_x, this.\_y+35, true)) {  
vel\_y = 0;  
jumping = false;  
}  
}  
onClipEvent (enterFrame) {  
this.\_y += 16;  
if (\_root.ground.hitTest(this.\_x, this.\_y+1, true)) {  
this.\_y -= 16;  
}  
}  
[/AS]

Any ideas on how fix either of this aspects would be a great help! Thanks in advance :).

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 8, 2004, 11:12pm UTC](https://forum.kirupa.com/t/need-help-resolving-game-bugs/42400/2 "2004-02-08T23:12:57Z")

</div>

It’s due to frame rate andf how many pixels your guy is falling… I’d suggest that when your character hits the platform… Put the character up to the right level right after that… No matter what.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 9, 2004, 12:45am UTC](https://forum.kirupa.com/t/need-help-resolving-game-bugs/42400/3 "2004-02-09T00:45:41Z")

</div>

How do I do that?

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 9, 2004, 1:00am UTC](https://forum.kirupa.com/t/need-help-resolving-game-bugs/42400/4 "2004-02-09T01:00:48Z")

</div>

if (\_root.ground.hitTest(this.\_x, this.\_y+35, true)) {  
vel\_y = 0;  
jumping = false;  
}

Take that statment… and add in…

this.\_x = ###; whatever the high point of the ground is.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 9, 2004, 1:05am UTC](https://forum.kirupa.com/t/need-help-resolving-game-bugs/42400/5 "2004-02-09T01:05:20Z")

</div>

How do you know what the high point is though. Besides I have multiple platforms in one mc, so that would make multiple high points.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 9, 2004, 1:24am UTC](https://forum.kirupa.com/t/need-help-resolving-game-bugs/42400/6 "2004-02-09T01:24:45Z")

</div>

TEst it… See how thick the mc is… You can do tests for this… And then test the loction of the actual MC clip… Now… You can do a test to figure out exactly how much you should displace your character from there.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 9, 2004, 1:39am UTC](https://forum.kirupa.com/t/need-help-resolving-game-bugs/42400/7 "2004-02-09T01:39:04Z")

</div>

Ok I did that and put in a value, but when I test it, my guy always snaps back to the original platform(the one he’s standing on in the picture) in mid jump. But I still don’t see how I would resolve the multiple high point issue. Here’s what the game looks like. As you can see It’s in one huge mc(the platforms)…so as long as I define one high point it screws me up even more

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 9, 2004, 1:06pm UTC](https://forum.kirupa.com/t/need-help-resolving-game-bugs/42400/8 "2004-02-09T13:06:18Z")

</div>

onClipEvent (enterFrame) {  
this.\_y += 16;  
if (\_root.ground.hitTest(this.\_x, this.\_y+1, true)) {  
this.\_y -= 16;  
}  
}

what on earth is this part doing? Try…

[AS]onClipEvent (enterFrame)  
{  
if((jumping == false) and(\_root.ground.hitTest(this.\_x, this.\_y-2, true)))  
{  
this.\_y -= 2;  
}  
}  
[/AS]

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 9, 2004, 2:06pm UTC](https://forum.kirupa.com/t/need-help-resolving-game-bugs/42400/9 "2004-02-09T14:06:22Z")

</div>

Thanks but when I tried that my guy jumped really high and landed like 3 cm of the platforms so…

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 9, 2004, 2:15pm UTC](https://forum.kirupa.com/t/need-help-resolving-game-bugs/42400/10 "2004-02-09T14:15:30Z")

</div>

[AS]onClipEvent (enterFrame) {  
if (Key.isDown(Key.UP) && !jumping) {  
vel\_y = [A LOWER VALUE!!];  
jumping = true;  
}  
if (jumping == true) {  
vel\_y -= 2;  
if (vel\_y\<=-15) {  
vel\_y = -15;  
}  
this.\_y -= vel\_y;  
}  
if (\_root.ground.hitTest(this.\_x, this.\_y+5, true)) {  
vel\_y = 0;  
jumping = false;  
}  
else if (\_root.ground.hitTest(this.\_x, this.\_y+10, true)) {  
vel\_y = 0;  
jumping = false;  
}  
else if (\_root.ground.hitTest(this.\_x, this.\_y+15, true)) {  
vel\_y = 0;  
jumping = false;  
}  
}[/AS]

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 9, 2004, 2:27pm UTC](https://forum.kirupa.com/t/need-help-resolving-game-bugs/42400/11 "2004-02-09T14:27:30Z")

</div>

Ok Thanks I tried that and the only problem now is that the guy doesn’t fall off of a platform if I just walk off, I have to jump off for him to fall.I didn’t fall through any of the platforms though.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 10, 2004, 10:46am UTC](https://forum.kirupa.com/t/need-help-resolving-game-bugs/42400/12 "2004-02-10T10:46:44Z")

</div>

> \*Originally posted by junahu \*  
> \*\*[AS]onClipEvent (enterFrame) {  
> if (Key.isDown(Key.UP) && !jumping) {  
> vel\_y = [A LOWER VALUE!!];  
> jumping = true;  
> }  
> else if(!(\_root.ground.hitTest(this.\_x,this.\_y,true) && !jumping)  
> {  
> jumping = true  
> }  
> if (jumping == true) {  
> vel\_y -= 2;  
> if (vel\_y\<=-15) {  
> vel\_y = -15;  
> }  
> this.\_y -= vel\_y;  
> }  
> if (\_root.ground.hitTest(this.\_x, this.\_y+5, true)) {  
> vel\_y = 0;  
> jumping = false;  
> }  
> else if (\_root.ground.hitTest(this.\_x, this.\_y+10, true)) {  
> vel\_y = 0;  
> jumping = false;  
> }  
> else if (\_root.ground.hitTest(this.\_x, this.\_y+15, true)) {  
> vel\_y = 0;  
> jumping = false;  
> }  
> }[/AS] \*\*

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 10, 2004, 12:18pm UTC](https://forum.kirupa.com/t/need-help-resolving-game-bugs/42400/13 "2004-02-10T12:18:22Z")

</div>

Ok So everything’s working great except now my guy sinks like a cm into the platforms, but the hitTest and falling is solid. I tried playing around with the values but it really didn’t change much. So how do I make sure that he is level with the platforms? Is there A value I’m forgetting to change?

[AS]  
onClipEvent (enterFrame) {  
if (Key.isDown(Key.UP) && !jumping) {  
\_root.boing.play();  
vel\_y = 20;  
jumping = true;  
} else if (!(\_root.ground.hitTest(this.\_x, this.\_y, true)) && !jumping) {  
jumping = true;  
}  
if (jumping == true) {  
vel\_y -= 2;  
if (vel\_y\<=-15) {  
vel\_y = -15;  
}  
this.\_y -= vel\_y;  
}  
if (\_root.ground.hitTest(this.\_x, this.\_y+2, true)) {  
vel\_y = 0;  
jumping = false;  
} else if (\_root.ground.hitTest(this.\_x, this.\_y+10, true)) {  
vel\_y = 0;  
jumping = false;  
} else if (\_root.ground.hitTest(this.\_x, this.\_y+15, true)) {  
vel\_y = 0;  
jumping = false;  
}  
}  
[/AS]
