PDA

View Full Version : Platform Hittest



BullDog_Flash
March 16th, 2004, 12:19 AM
Ok im making a platform game first time since I ever started Flash programming..


Anyways I want the Character to not fall through the platform or jump form below a platform and go through it.

The Code

onClipEvent (enterFrame) {
if (hitTest(_root.hero)) {
_root.hero._y = this._y-68;
_root.hero.platform = "on";
}
}

Thats the code that im using came from a tut that im doing but found that the tut wasent all that great so started folli around with the code.

Also with that code if i make the platform bigger it doesent work and it takes a long time in order to get the platform wokring.

I was thikin of adding alot of diffrent platform but dont want to keep changin the code.

Anyone Got Some Help?

BullDog_Flash
March 16th, 2004, 12:19 PM
So NoBody Knows???

flash4food
March 17th, 2004, 12:43 AM
it would be easier to putt all the platforms in one MC and use a real hittest (platforms.hitTest(_x, _y, true)) so u only have to code once

junahu
March 17th, 2004, 10:00 AM
Which, symultaneuously would enable you to easily do other checks (like whether you're hitting a platformer from below [platforms.hitTest(_x,_y - _height,true)])