Author Topic: equivalent to hitLeft and hitFloor in new flixel version?  (Read 1618 times)

Tyranus

  • Member
  • **
  • Posts: 54
  • Karma: +0/-0
    • View Profile
    • Tyranus:: Indie Games.
Hi there!

Well, just this: what is the equivalent to hitLeft and hitFloor in new flixel version?

I need to know the velocity.y when a FlxObjetc touch the floor.

Thanks!!!

Arkeus

  • Contributor
  • ****
  • Posts: 321
  • Karma: +1/-0
    • View Profile
    • I, Arkeus
You can check:

if (touching & DOWN) {

}

or alternatively (the same thing)

if (isTouching(DOWN)) {

}

I think there are also options for "justTouched" which is probably more equivalent to hitFloor.

Tyranus

  • Member
  • **
  • Posts: 54
  • Karma: +0/-0
    • View Profile
    • Tyranus:: Indie Games.
Thanks Arkeus!, but the problem is that I need to know velocity before Flixel reset velocity.y to zero.

If I do this:

if (isTouching(FLOOR) && velocity>0) {
     // never execute this code becouse flixel fix position and velocity before :'(
}

osro

  • Active Member
  • ***
  • Posts: 121
  • Karma: +1/-0
    • View Profile
    • Purppura
Could you store the "last" velocity.y just before hitting the floor in preUpdate()?