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:
verysecrethero
2016-02-10 11:51:58 +01:00
parent 067780c93f
commit b6b96c5f11
4 changed files with 43 additions and 1 deletions
@@ -5,6 +5,9 @@
#include "Input/FirstPersonInputController.h"
#include <imgui/imgui.h>
#include "Core/EntityFile.h"
#include "Core/EntityFileParser.h"
class PlayerMovementSystem : public ImpureSystem, PureSystem
{
public:
+3
View File
@@ -2,6 +2,9 @@
Sensitivity=0.5
InvertPitch=false
[KeyBoard]
DoubleTapToDash=true
[Bindings]
MouseLeft=PrimaryFire
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>
+7 -1
View File
@@ -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
if (!controller->PlayerIsDashing() && controller->Jumping() && !controller->Crouching() && (isOnGround || !controller->DoubleJumping())) {
(bool)cPhysics["IsOnGround"] = false;
if (velocity.y == 0.f) {
if (isOnGround) {
controller->SetDoubleJumping(false);
} 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);
}
velocity.y = 4.f;