diff --git a/client/levels/test/game.tscn b/client/levels/test/game.tscn index 0c1ce374530b1ef0854a124b9c6f309e998d30ef..4f0577175213a8c50c3cdc23cc90e0e6e125d803 100644 --- a/client/levels/test/game.tscn +++ b/client/levels/test/game.tscn @@ -13,7 +13,7 @@ fov = 30.0 [node name="structure" type="Spatial" parent="."] [node name="bloc" parent="structure" instance=ExtResource( 2 )] -transform = Transform( 10, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0 ) +transform = Transform( 30, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0 ) [node name="bloc2" parent="structure" instance=ExtResource( 2 )] transform = Transform( 5, 0, 0, 0, 1, 0, 0, 0, 1, 0, 4.15191, 0 ) diff --git a/client/project.godot b/client/project.godot index 936fcb642772d9109535f83e7acdc6d2878940f4..a3b0c0649b0a95b1a438d21a23b26dbf8c2c4812 100644 --- a/client/project.godot +++ b/client/project.godot @@ -35,6 +35,7 @@ movementJump={ "deadzone": 0.5, "events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":32,"unicode":0,"echo":false,"script":null) , Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777232,"unicode":0,"echo":false,"script":null) +, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":90,"unicode":0,"echo":false,"script":null) ] } movementRight={ diff --git a/server/entities/characters/player.gd b/server/entities/characters/player.gd index e514a60fb99d5ff5c3590df9c0f35dc792dbd551..cb9a8fb615801e17a816012732f159e3ccf0413f 100644 --- a/server/entities/characters/player.gd +++ b/server/entities/characters/player.gd @@ -16,7 +16,8 @@ var isSprinting:bool = false # Acceleration values const ACCEL:float = 8.5 const SPRINT_ACCEL:float = 16.0 -const DEACCEL:float = 16.0 +const MVMNT_MOMENTUM:float = 10.0 +const THROW_MOMENTUM:float = 2.0 # Jump and fall values const JUMP_SPEED:float = 16.0 @@ -73,12 +74,12 @@ func _physics_process(delta): # Called from the game script to update the vars func getPlayerInputs(movementInput, jumpInput, jumpId, sprintInput, attackTypeInput): motion = 0 - # Prevent the player from moving when attacking if isAttacking: return motion = movementInput + isSprinting = sprintInput isJumping = false @@ -107,6 +108,7 @@ func processMovement(delta): currentJump = 0 # Reset the last striker lastStrikerId = ownId + elif currentJump == 0 && !isJumping: # Initial jump prevented currentJump = 1 @@ -137,8 +139,10 @@ func processMovement(delta): accel = SPRINT_ACCEL else: accel = ACCEL + elif !is_on_floor()&&!isJumping: + accel = THROW_MOMENTUM else: - accel = DEACCEL + accel = MVMNT_MOMENTUM # Interpolating speed and acceleration through time and getting it vel.x = hvel.linear_interpolate(target, accel * delta).x @@ -205,7 +209,7 @@ func secondaryAttack(): # Called when detected by an attack's hitbox func hurt(damages:int, sourceId:int, force:Vector3): hp += damages - vel += Vector3(force.x*hp,force.y,force.z) + vel += Vector3(force.x*hp/2,force.y,force.z) lastStrikerId = sourceId rpc_unreliable_id(ownId, "hurt", hp) diff --git a/server/levels/test/game.tscn b/server/levels/test/game.tscn index 0e4f9308d78685900291e615b8732176abe9f014..3fc537312e69e3ccb1eef828f0ca296cb9b8d024 100644 --- a/server/levels/test/game.tscn +++ b/server/levels/test/game.tscn @@ -16,7 +16,7 @@ fov = 30.0 [node name="structure" type="Spatial" parent="."] [node name="bloc" parent="structure" instance=ExtResource( 2 )] -transform = Transform( 10, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0 ) +transform = Transform( 30, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0 ) [node name="bloc2" parent="structure" instance=ExtResource( 2 )] transform = Transform( 5, 0, 0, 0, 1, 0, 0, 0, 1, 0, 4.15191, 0 )