Added DoubleJumpHexagon entity. Spawned DoubleJumpHexagon as the player doublejumps. Fixed DoubleJumping bug where you couldnt doublejump on rocks (where velocity wasnt 0.0)
This commit is contained in:
@@ -5,6 +5,9 @@
|
|||||||
#include "Input/FirstPersonInputController.h"
|
#include "Input/FirstPersonInputController.h"
|
||||||
#include <imgui/imgui.h>
|
#include <imgui/imgui.h>
|
||||||
|
|
||||||
|
#include "Core/EntityFile.h"
|
||||||
|
#include "Core/EntityFileParser.h"
|
||||||
|
|
||||||
class PlayerMovementSystem : public ImpureSystem, PureSystem
|
class PlayerMovementSystem : public ImpureSystem, PureSystem
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|||||||
@@ -2,6 +2,9 @@
|
|||||||
Sensitivity=0.5
|
Sensitivity=0.5
|
||||||
InvertPitch=false
|
InvertPitch=false
|
||||||
|
|
||||||
|
[KeyBoard]
|
||||||
|
DoubleTapToDash=true
|
||||||
|
|
||||||
[Bindings]
|
[Bindings]
|
||||||
MouseLeft=PrimaryFire
|
MouseLeft=PrimaryFire
|
||||||
MouseX=Yaw
|
MouseX=Yaw
|
||||||
|
|||||||
@@ -0,0 +1,30 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
|
||||||
|
<Entity xmlns:c="components" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../Types/Entity.xsd">
|
||||||
|
|
||||||
|
<Components>
|
||||||
|
<c:Model>
|
||||||
|
<Resource>Models/JumpEffectHexagon.mesh</Resource>
|
||||||
|
<Color A="0.576470613" B="0.635294139" G="0.788235307" R="0.854901969"/>
|
||||||
|
<Transparent>true</Transparent>
|
||||||
|
</c:Model>
|
||||||
|
<c:Transform>
|
||||||
|
<Position X="0.600000024" Y="0.800000012" Z="0"/>
|
||||||
|
<Scale X="0.50000012" Y="0.50000019" Z="0.50000014"/>
|
||||||
|
</c:Transform>
|
||||||
|
<c:Lifetime>
|
||||||
|
<Lifetime>1.5</Lifetime>
|
||||||
|
</c:Lifetime>
|
||||||
|
<c:ExplosionEffect>
|
||||||
|
<ColorByDistance>true</ColorByDistance>
|
||||||
|
<Velocity X="0" Y="-7.76300049" Z="0"/>
|
||||||
|
<ExplosionOrigin X="0" Y="2.67900002" Z="0"/>
|
||||||
|
<ExponentialAccelaration>true</ExponentialAccelaration>
|
||||||
|
<ExplosionDuration>3</ExplosionDuration>
|
||||||
|
<EndColor A="0" B="0" G="0" R="1"/>
|
||||||
|
<Randomness>true</Randomness>
|
||||||
|
</c:ExplosionEffect>
|
||||||
|
</Components>
|
||||||
|
|
||||||
|
<Children/>
|
||||||
|
|
||||||
|
</Entity>
|
||||||
@@ -90,9 +90,15 @@ void PlayerMovementSystem::Update(double dt)
|
|||||||
//you cant jump and dash at the same time - since there is no friction in the air and we would thus dash much further in the air
|
//you cant jump and dash at the same time - since there is no friction in the air and we would thus dash much further in the air
|
||||||
if (!controller->PlayerIsDashing() && controller->Jumping() && !controller->Crouching() && (isOnGround || !controller->DoubleJumping())) {
|
if (!controller->PlayerIsDashing() && controller->Jumping() && !controller->Crouching() && (isOnGround || !controller->DoubleJumping())) {
|
||||||
(bool)cPhysics["IsOnGround"] = false;
|
(bool)cPhysics["IsOnGround"] = false;
|
||||||
if (velocity.y == 0.f) {
|
if (isOnGround) {
|
||||||
controller->SetDoubleJumping(false);
|
controller->SetDoubleJumping(false);
|
||||||
} else {
|
} else {
|
||||||
|
//put a hexagon at the players feet
|
||||||
|
auto hexagonEffect = ResourceManager::Load<EntityFile>("Schema/Entities/DoubleJumpHexagon.xml");
|
||||||
|
EntityFileParser parser(hexagonEffect);
|
||||||
|
EntityID hexagonEffectID = parser.MergeEntities(m_World);
|
||||||
|
EntityWrapper hexagonEW = EntityWrapper(m_World, hexagonEffectID);
|
||||||
|
hexagonEW["Transform"]["Position"] = (glm::vec3)player["Transform"]["Position"];
|
||||||
controller->SetDoubleJumping(true);
|
controller->SetDoubleJumping(true);
|
||||||
}
|
}
|
||||||
velocity.y = 4.f;
|
velocity.y = 4.f;
|
||||||
|
|||||||
Reference in New Issue
Block a user