A Flash Developer Resource Site

# Thread: Plaatform game help with walls

1. ## Plaatform game help with walls

Hello!! I don't know if anyone remembers the attached? Part of the platform game tutorials. At the moment the ball passes straight through the platforms. Anyone know how to modify it so the ball cannot pass through it?

I'm trying to create slopes for a character to walk down and walk up.. and using this code walking down isn't too bad, but walking up won't work at all as the character just walks straight through the slope.

Cheers
Steve

2. The code is as follows:

jumpping = true;
}
//Makes The character jump
onClipEvent (enterFrame) {
if (jumpping) {
this._y -= jumpp;
jumpp -= .5;
if (jumpp<0) {
falling = true;
}
if (jumpp<-15) {
jumpp = -15;
}
}
if (_root.platform.hitTest(this._x, this._y, true) && falling) {
jumpp = 0.000000000000000000000000000000001;
jumpping = true;
falling = false;
}

if (Key.isDown(Key.RIGHT)) {
//edit the number to make him walk faster
this._x += 5;
// Makes the Character move left.
} else if (Key.isDown(Key.LEFT)) {
//edit the number to make him walk faster
this._x -= 5;
}

if (Key.isDown(Key.UP)) {
JUMPing = true;
}
if (JUMPing) {
this._y -= JUMP;
//kind of like gravity the higher it is the lower it bounces.
JUMP -= .5;
if (JUMP<5) {
//makes it smoothly come down after its reached the maximum bounce hight.
if (JUMP<-10) {
JUMP = -10;
}
}
//Helps him land on the platform when he falls.
if (_root.platform.hitTest(this._x, this._y, true)) {
//Jumping Hight
JUMP = 15;
JUMPing = false
//End jumping Code
}

if (Key.isDown(Key.UP)) {
FALL = true;
}
if (FALL) {
this._y -= FALL;
//kind of like gravity the higher it is the lower it bounces.
FALL -= .5;
if (FALL<5) {
//makes it smoothly come down after its reached the maximum bounce hight.
if (FALL<-10) {
FALL = -10;
}
}
//Helps him land on the platform when he falls.
if (_root.platform.hitTest(this._x, this._y, true)) {
//Jumping Hight
FALL = .00001;
FALL = true
//End jumping Code
}
}
}
}

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•

 » Home » Movies » Tutorials » Submissions » Board » Links » Reviews » Feedback » Gallery » Fonts » The Lounge » Sound Loops » Sound FX » About FK » Sitemap