Skip to content

Commit

Permalink
Add run jump speed
Browse files Browse the repository at this point in the history
  • Loading branch information
kidagine committed Jan 26, 2024
1 parent a49e7d6 commit 8cc0500
Show file tree
Hide file tree
Showing 6 changed files with 112 additions and 102 deletions.
4 changes: 2 additions & 2 deletions Assets/_Project/Scenes/GameScenes/1. GameScene.unity
Original file line number Diff line number Diff line change
Expand Up @@ -18894,12 +18894,12 @@ MonoBehaviour:
_assistTwo: 0
_controllerOne: 0
_controllerOneType: 0
_controllerTwo: 0
_controllerTwo: -1
_controllerTwoType: 0
_music: 0
_playerOneSkin: 0
_playerTwoSkin: 0
_isTrainingMode: 0
_isTrainingMode: 1
_1BitOn: 0
_gameSpeed: 1
_countdownTime: 99
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ public class PlayerNetwork
public bool usedShadowbreak;
public bool hitstop;
public bool juggleBounce;
public bool runJump;
public string state;
public int spriteOrder;
public State CurrentState;
Expand Down Expand Up @@ -137,6 +138,7 @@ public void Serialize(BinaryWriter bw)
bw.Write(flip);
bw.Write(spriteOrder);
bw.Write(state);
bw.Write(runJump);
inputBuffer.Serialize(bw);
inputHistory.Serialize(bw);
hurtbox.Serialize(bw);
Expand Down Expand Up @@ -208,6 +210,7 @@ public void Deserialize(BinaryReader br)
canChainAttack = br.ReadBoolean();
usedShadowbreak = br.ReadBoolean();
juggleBounce = br.ReadBoolean();
runJump = br.ReadBoolean();
flip = br.ReadInt32();
spriteOrder = br.ReadInt32();
state = br.ReadString();
Expand All @@ -216,6 +219,7 @@ public void Deserialize(BinaryReader br)
hurtbox.Deserialize(br);
hitbox.Deserialize(br);
shadow.Deserialize(br);

attackNetwork.Deserialize(br);
attackHurtNetwork.Deserialize(br);
for (int i = 0; i < projectiles.Length; ++i)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,11 @@ public override void UpdateLogic(PlayerNetwork player)
player.SetParticle("Fall", new DemonVector2(player.position.x, player.position.y + 18));
player.hasJumped = true;
player.animationFrames = 0;
player.velocity = new DemonVector2((DemonFloat)1.6f * (DemonFloat)player.jumpDirection, player.playerStats.JumpForce);
if (player.runJump)
player.velocity = new DemonVector2((DemonFloat)2.1f * (DemonFloat)player.jumpDirection, player.playerStats.JumpForce);
else
player.velocity = new DemonVector2((DemonFloat)1.6f * (DemonFloat)player.jumpDirection, player.playerStats.JumpForce);

if (player.inputBuffer.CurrentTrigger().frame != 0)
{
player.isAir = true;
Expand All @@ -33,6 +37,7 @@ public override void UpdateLogic(PlayerNetwork player)
}
return;
}
player.runJump = false;
player.animationFrames++;
player.velocity = new DemonVector2(player.velocity.x, player.velocity.y - (float)DemonicsPhysics.GRAVITY);
ToFallState(player);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ private void ToJumpForwardState(PlayerNetwork player)
{
if (player.direction.y > 0 && player.direction.x != 0)
{
player.runJump = true;
player.jumpDirection = (int)player.direction.x;
EnterState(player, "PreJump");
}
Expand Down
Loading

0 comments on commit 8cc0500

Please sign in to comment.