NANNERS
01-26-2011, 03:00 AM
I have my player named "Player" and a little square named "Feet" at its feet. They are both Movie Clips.
I have a simple box named "Crate" and a simple floor named "Ground".
Way back when I used to have it do collision with the Player itself, which worked fine. Then I swapped out the line that said "Player" in the collision check with "Feet", but it continues to use "Player".
TouchingGround = false; // Used by my gravity code, if false, player will fall
for(i in _root)
{
if(typeof(_root[i])=="movieclip") // Yes they're all movie clips
{
if (_root[i].ofType == "GROUND") // Each object I want collision with has this variable applied to it
{
if (_root[i]._name <> "Player") // Because the feet are always touching the player
{
if (_root.Feet, hitTest(_root[i])) // If the feet are colliding with any one of these objects
{
TouchingGround = true; // Disable falling with my gravity function
}
}
}
}
}
I've quadruple checked names and made absolutely sure everything has the right variable. In fact I can place whatever I want where "_root.Feet" is (like "hfksalhfklsa") and the code compiles just fine and continues to use the player as colliding check. If I delete the TouchingGround = true; then I will fall forever, so it is actually accepting the code.
Does anyone have any idea what's going on? I can't see any reason it won't use my Feet movie clip. It only ever uses the Player movie clip for collision.
I have a simple box named "Crate" and a simple floor named "Ground".
Way back when I used to have it do collision with the Player itself, which worked fine. Then I swapped out the line that said "Player" in the collision check with "Feet", but it continues to use "Player".
TouchingGround = false; // Used by my gravity code, if false, player will fall
for(i in _root)
{
if(typeof(_root[i])=="movieclip") // Yes they're all movie clips
{
if (_root[i].ofType == "GROUND") // Each object I want collision with has this variable applied to it
{
if (_root[i]._name <> "Player") // Because the feet are always touching the player
{
if (_root.Feet, hitTest(_root[i])) // If the feet are colliding with any one of these objects
{
TouchingGround = true; // Disable falling with my gravity function
}
}
}
}
}
I've quadruple checked names and made absolutely sure everything has the right variable. In fact I can place whatever I want where "_root.Feet" is (like "hfksalhfklsa") and the code compiles just fine and continues to use the player as colliding check. If I delete the TouchingGround = true; then I will fall forever, so it is actually accepting the code.
Does anyone have any idea what's going on? I can't see any reason it won't use my Feet movie clip. It only ever uses the Player movie clip for collision.