Forum Topic: Going into wall..

(123 views • 4 replies)

This topic is 1 page long.

<< < > >>
Expressionless

Eggy

Reply To Post Reply & Quote

Posted at: 2/22/09 11:14 PM

Eggy LIGHT LEVEL 32

Sign-Up: 05/22/05

Posts: 1,324

i can't figure out this simple thing..

I had it as

speed = 5

if (_root.ground.hitTest(_x+(hit._width/2), _y-(hit._height/2), true) or _root.ground.hitTest(_x+(hit._width/2), _y-3, true) or _root.ground.hitTest(_x+(hit._width/2), _y-(hit._height), true)) {
_x -= speed;
}

if (Key.isDown(Key.RIGHT)) {
_x += speed
}

and this worked fine so I decided to change it and make it

_x += speed
speed += 1
}

and now it wont hit the wall at all, if i put on a trace on the wall, it doesnt even register the hitTest.

Eh I'm baffled wioth this simple thing :/ small mistake somewhere?..


None

XBigTK13X

Reply To Post Reply & Quote

Posted at: 2/23/09 01:28 AM

XBigTK13X LIGHT LEVEL 28

Sign-Up: 08/04/05

Posts: 370

Please post a SWF so we can see exactly what the issue is.


None

Juice-Tin

Reply To Post Reply & Quote

Posted at: 2/23/09 01:35 AM

Juice-Tin LIGHT LEVEL 09

Sign-Up: 02/03/01

Posts: 852

May be that the wall is too thin, and now your player is moving through it, because of the increase in speed.

But yes, an swf would help
Upload Here

BBS Signature

None

Eggy

Reply To Post Reply & Quote

Posted at: 2/23/09 03:17 AM

Eggy LIGHT LEVEL 32

Sign-Up: 05/22/05

Posts: 1,324


None

Montycarlo

Reply To Post Reply & Quote

Posted at: 2/23/09 05:16 AM

Montycarlo LIGHT LEVEL 18

Sign-Up: 03/14/05

Posts: 698

This is happening because you're adding the speed variable to the x property after the hitTest's, and then executing the while loop to position the player above(Or on) the ground.


All times are Eastern Standard Time (GMT -5) | Current Time: 11:27 AM

<< Back

This topic is 1 page long.

<< < > >>
You need a Grounds Gold Account to post on the NG BBS! If you don't have one, click here to sign up now! It's fast, free, and easy — and opens up tons of great NG features!