wrefd
This commit is contained in:
+10
-6
@@ -145,7 +145,7 @@ void Engine::Initiate()
|
||||
Character* testcharacter = new Character();
|
||||
testcharacter->name = "character";
|
||||
testcharacter->castshadow = true;
|
||||
testcharacter->body->t.ScaleBy({ 0.5f, 1.8f, 0.5f });
|
||||
testcharacter->body->t.ScaleBy({ 0.6f, 2.1f, 0.6f });
|
||||
testcharacter->body->t.TranslateTo({ 0.0f, 10.0f, 0.0f });
|
||||
testcharacter->body->SetRig(testrig);
|
||||
|
||||
@@ -172,8 +172,8 @@ void Engine::Initiate()
|
||||
Character* npc = new Character();
|
||||
npc->name = "npc";
|
||||
npc->castshadow = true;
|
||||
npc->body->t.ScaleBy({ 0.5f, 1.8f, 0.5f });
|
||||
npc->body->t.TranslateTo({ 3.0f, 0.9f, 3.0f });
|
||||
npc->body->t.ScaleBy({ 0.6f, 2.1f, 0.6f });
|
||||
npc->body->t.TranslateTo({ 3.0f, 1.05f, 3.0f });
|
||||
npc->body->SetRig(testrig);
|
||||
npc->body->SetAnimation(testanimation);
|
||||
npc->BindToRenderSystem();
|
||||
@@ -197,7 +197,7 @@ void Engine::Initiate()
|
||||
Character* c = new Character();
|
||||
c->name = "remote";
|
||||
c->castshadow = true;
|
||||
c->body->t.ScaleBy({ 0.5f, 1.8f, 0.5f });
|
||||
c->body->t.ScaleBy({ 0.6f, 2.1f, 0.6f });
|
||||
c->body->SetRig(testrig);
|
||||
c->body->SetAnimation(testanimation);
|
||||
c->BindToRenderSystem();
|
||||
@@ -448,13 +448,15 @@ void Engine::Initiate()
|
||||
const float slideDuration = 0.8f;
|
||||
const float slideFalloffTime = 0.7f;
|
||||
const float slideDropY = 0.65f; // standing centre height (0.9) minus lying (0.25)
|
||||
const float standEyeOffset = 0.7f; // eyes 0.7 above body centre (body centre 0.9, height 1.8)
|
||||
const float standEyeOffset = 0.85f; // eyes 0.85 above body centre (body centre 1.05, height 2.1)
|
||||
const float slideEyeOffset = 0.25f; // lying down, eyes just above the floor
|
||||
float eyeOffset = standEyeOffset;
|
||||
bool sliding = false;
|
||||
float slideTime = 0.0f;
|
||||
const float slideCooldownTime = 1.0f; // seconds after a slide ends before the next
|
||||
float slideCooldown = 0.0f;
|
||||
const float dashCooldownTime = 1.5f; // seconds between dashes
|
||||
float dashCooldown = 0.0f;
|
||||
glm::vec3 slideDir(0.0f);
|
||||
|
||||
// Shockwave (key Q): projectile that explodes on the first surface it touches. The blast
|
||||
@@ -721,7 +723,8 @@ void Engine::Initiate()
|
||||
std::cout << "PUNCH - player " << kv.first << "\n";
|
||||
}
|
||||
}
|
||||
if (buffer.GetCode() == GLFW_KEY_LEFT_SHIFT && buffer.IsPress() && !sliding) {
|
||||
if (buffer.GetCode() == GLFW_KEY_LEFT_SHIFT && buffer.IsPress() && !sliding && dashCooldown <= 0.0f) {
|
||||
dashCooldown = dashCooldownTime;
|
||||
glm::vec3 dashDir = glm::length(inputVel) > 0.0f
|
||||
? glm::normalize(inputVel)
|
||||
: glm::normalize(glm::vec3(camFront.x, 0.0f, camFront.z));
|
||||
@@ -798,6 +801,7 @@ void Engine::Initiate()
|
||||
// Movement + damping
|
||||
grappleCooldown = std::max(grappleCooldown - deltatime, 0.0f);
|
||||
slideCooldown = std::max(slideCooldown - deltatime, 0.0f);
|
||||
dashCooldown = std::max(dashCooldown - deltatime, 0.0f);
|
||||
const float accel = 40.0f;
|
||||
const float damp = 0.75f;
|
||||
const float groundTopSpeed = movespeed * accel * refDt * damp / (1.0f - damp);
|
||||
|
||||
Reference in New Issue
Block a user