Biles Wrote:I managed to get the moving thing done so far, but far from perfect. When I move Vicka, she still remains in her standing form facing one direction. Upon jumping, she remains stuck in jump form in one direction, even when I move about or don't. Jumping again toggles the facing direction. This is the code that I have currently running on her as of now
So, just to make sure. You have the main character model, and inside that is the notice area and movement model, and then you have the various movement movies. Frame 1 is Vicka standing still, facing right.
Frame 2 is Vicka walking, facing right.
Frame 3 is Vicka standing still, facing left (that is, the standing movie for her facing right but flipped horizontally).
Frame 4 is Vicka walking, facing left (again, the walking movie for her facing right but flipped horizontally).
Frame 5 (difference from MiM) should be Vicka jumping, facing right.
Frame 6 should be Vicka jumping, facing left (flipped again).
Frame 7 would be her crouched, facing right.
Frame 8 would be her crawling, facing right.
Frame 9 would be her crouched, facing left.
Frame 10 would be her crawling, facing left.
I'll take the code from above and modify it here, so you should be able to copy it and overwrite what was there before, assuming that you have the animations as listed in the frames above. You can also add labels and change the 'gotoAndStop' references below to those lables (like 'standright', 'standleft', 'crouchright', etc.) so that you can reorganize the frames to your preference. Also, if you decide you want a falling animation, that's going to require math and testing. >_>
- Code: Select All Code
onClipEvent (load)
{
var ground = _root.ground; //removes the need to add _root. when referencing ground (I guess?)
var grav = 0; //base gravity
var gravity = 2; //gravity modifier
var maxJump = -32; //deeper into negatives = higher jump
var speed = 10; //higher number is more speed
var touchingGround = false; //defaults to being in the air
var masturbating = false; //defaults to not stuck in a masturbation loop
char._x = _root.CheckpointX[_root.Checkpoint]; //move character to default checkpoint to start
char._y = _root.CheckpointY[_root.Checkpoint]; //move character to default checkpoint to start
}
onClipEvent (enterFrame)
{
if (_root.movement)
{ //if the character is not in a sex scene or when they should be able to freely move
setProperty("", _y, _y + grav);
for (grav = grav + gravity; ground.hitTest(_x, _y, true); grav = 0)
{
setProperty("", _y, _y - gravity);
} // end of for
if (ground.hitTest(_x, _y + 5, true))
{ //if the character falls through the ground, increase the 5, decrease reduces hovering
touchingGround = true;
}
else
{
touchingGround = false;
} // end else if
if (Key.isDown(39) or Key.isDown(68))
{
setProperty("", _x, _x + speed);
right = true;
if (touchingGround)
{
if (crouching)
{
_root.char.character.gotoAndStop(8);
}
else
{
_root.char.character.gotoAndStop(2);
}
}
else
{
_root.char.character.gotoAndStop(5);
}
}
else if (right)
{
if (touchingGround)
{
if (crouching)
{
_root.char.character.gotoAndStop(7);
}
else
{
_root.char.character.gotoAndStop(1);
}
}
else
{
_root.char.character.gotoAndStop(5);
}
} // end facing and moving right
if (Key.isDown(37) or Key.isDown(65))
{
setProperty("", _x, _x - speed);
right = false;
if (touchingGround)
{
if (crouching)
{
_root.char.character.gotoAndStop(10);
}
else
{
_root.char.character.gotoAndStop(4);
}
}
else
{
_root.char.character.gotoAndStop(6);
}
}
else if (!right)
{
if (touchingGround)
{
if (crouching)
{
_root.char.character.gotoAndStop(9);
}
else
{
_root.char.character.gotoAndStop(3);
}
}
else
{
_root.char.character.gotoAndStop(6);
}
} // end facing and moving left
if ((Key.isDown(38) or Key.isDown(87)) && touchingGround) //Starts the jump
{
grav = maxJump;
gotoAndPlay("jump"); //this is just the sound effect for jumping, it has no other purpose
this(undefined); //no idea what all the undefined stuff is about >_>
} // end if
if (Key.isDown(40) or Key.isDown(83) && touchingGround)
{
crouching = true;
}
else
{
crouching = false;
}
if (ground.hitTest(_x + _width / 4, _y - _height / 4, true))
{
setProperty("", _x, _x - speed);
} // end if
if (ground.hitTest(_x - _width / 4, _y - _height / 4, true))
{
setProperty("", _x, _x + speed);
_root.HUD._x = _x - 145; //the 145 is arbitrary to place the HUD properly in the vCam
} // end if
if (ground.hitTest(_x, _y - height, true))
{
grav = 3;
} // end if
} // end movement code
} // end onClipEvent
*crossing fingers*
<_<