As I said, you have one actor control the movement of another. Look inside the base_player.zs file inside scripts/zs.
Code: Select all
void HandleControls()
{
let input = camera.GetPlayerInput(INPUT_BUTTONS);
// reset velocity
// player stops moving instantly in Hotline Miami
vel = (0, 0, vel.z);
// velocities for moving forward & left
let frwdvel = (speed * cos(camera.angle), speed * sin(camera.angle), 0);
let leftvel = (speed * cos(camera.angle + 90), speed * sin(camera.angle + 90), 0);
Vector3 tempvel;
if (input & BT_FORWARD)
tempvel += frwdvel;
if (input & BT_BACK)
tempvel -= frwdvel;
if (input & BT_MOVELEFT)
tempvel += leftvel;
if (input & BT_MOVERIGHT)
tempvel -= leftvel;
if (tempvel == (0, 0, 0))
{
if (legs.pos != pos) legs.SetOrigin(pos,true);
if (body.pos != pos) body.SetOrigin(pos,true);
if (camera.pos.x != pos.x || camera.pos.y != pos.y)
camera.SetOrigin(Vec3Offset(tempvel.x, tempvel.y, camera.CamZ), true);
//camera.SetOrigin((pos.x, pos.y, camera.pos.z), true);
legs.vel = body.vel = camera.vel = tempvel;
return;
}
Vector3 oldpos = (pos.x, pos.y, pos.z);
Vector2 newpos = Vec2Offset(tempvel.x, tempvel.y);
vel = tempvel;
if (!A_CheckBlock("Null",CBF_ABSOLUTEPOS,AAPTR_DEFAULT,newpos.x,newpos.y,0,0))
{
Vector2 diffpos = (pos.x - oldpos.x,pos.y - oldpos.y);
legs.vel = body.vel = vel = tempvel;
camera.vel = (tempvel.x, tempvel.y, camera.vel.z);
}
else
{
legs.SetOrigin(pos, true);
body.SetOrigin(pos, true);
vel = tempvel;
legs.vel = body.vel = (0, 0, vel.z);
}
camera.SetOrigin(Vec3Offset(vel.x, vel.y, camera.CamZ), true);
}
Only use
ONE ACTOR to do the updating. That's the key part.
However, I suggest you drag TheZombieKiller in here to post his even more recently revised one as that one takes care of some further issues which mine had.