adjusted jump height

This commit is contained in:
pennyrigate 2022-12-17 00:04:41 -05:00
parent 8f6a068eba
commit 28319efe0d
3 changed files with 22 additions and 16 deletions

View file

@ -162,12 +162,11 @@ left_up_boundry = 3.0
right_down_boundry = 3.0
speed = 35
[node name="ColorRect" type="ColorRect" parent="."]
[node name="ColorRect" type="ColorRect" parent="." groups=["debug"]]
margin_left = 256.0
margin_right = 512.0
margin_bottom = 192.0
color = Color( 0.87451, 0, 1, 0.0901961 )
script = ExtResource( 9 )
__meta__ = {
"_edit_lock_": true
}
@ -189,3 +188,5 @@ margin_bottom = 8.0
color = Color( 0, 0, 0, 1 )
[node name="HUD" parent="." instance=ExtResource( 6 )]
[connection signal="ready" from="ColorRect" to="ColorRect" method="queue_free"]

View file

@ -31,16 +31,19 @@ shader_param/palette = ExtResource( 8 )
shader = ExtResource( 1 )
shader_param/palette = ExtResource( 9 )
[node name="HUD" type="Control"]
[node name="CanvasLayer" type="CanvasLayer"]
layer = 100
[node name="HUD" type="Control" parent="."]
margin_top = 1.0
margin_bottom = 1.0
script = ExtResource( 6 )
[node name="Back" type="Sprite" parent="."]
[node name="Back" type="Sprite" parent="HUD"]
position = Vector2( 128, 8 )
texture = ExtResource( 3 )
[node name="GoldCounter" type="Label" parent="."]
[node name="GoldCounter" type="Label" parent="HUD"]
margin_left = 14.0
margin_top = 1.0
margin_right = 54.0
@ -48,7 +51,7 @@ margin_bottom = 21.0
theme = ExtResource( 10 )
text = "000"
[node name="ShardCounter" type="Label" parent="."]
[node name="ShardCounter" type="Label" parent="HUD"]
margin_left = 53.0
margin_top = 1.0
margin_right = 93.0
@ -56,7 +59,7 @@ margin_bottom = 21.0
theme = ExtResource( 10 )
text = "00"
[node name="RedStar" type="Sprite" parent="."]
[node name="RedStar" type="Sprite" parent="HUD"]
visible = false
material = SubResource( 1 )
position = Vector2( 79, 8 )
@ -64,7 +67,7 @@ texture = ExtResource( 4 )
region_enabled = true
region_rect = Rect2( 0, 0, 11, 11 )
[node name="YellowStar" type="Sprite" parent="."]
[node name="YellowStar" type="Sprite" parent="HUD"]
visible = false
material = SubResource( 2 )
position = Vector2( 92, 8 )
@ -72,7 +75,7 @@ texture = ExtResource( 4 )
region_enabled = true
region_rect = Rect2( 0, 0, 11, 11 )
[node name="GreenStar" type="Sprite" parent="."]
[node name="GreenStar" type="Sprite" parent="HUD"]
visible = false
material = SubResource( 3 )
position = Vector2( 105, 8 )
@ -80,7 +83,7 @@ texture = ExtResource( 4 )
region_enabled = true
region_rect = Rect2( 0, 0, 11, 11 )
[node name="BlueStar" type="Sprite" parent="."]
[node name="BlueStar" type="Sprite" parent="HUD"]
visible = false
material = SubResource( 4 )
position = Vector2( 118, 8 )
@ -88,7 +91,7 @@ texture = ExtResource( 4 )
region_enabled = true
region_rect = Rect2( 0, 0, 11, 11 )
[node name="MagentaStar" type="Sprite" parent="."]
[node name="MagentaStar" type="Sprite" parent="HUD"]
visible = false
material = SubResource( 5 )
position = Vector2( 131, 8 )
@ -96,7 +99,7 @@ texture = ExtResource( 4 )
region_enabled = true
region_rect = Rect2( 0, 0, 11, 11 )
[node name="ScoreText" type="Label" parent="."]
[node name="ScoreText" type="Label" parent="HUD"]
margin_left = 142.0
margin_top = 1.0
margin_right = 226.0
@ -104,7 +107,7 @@ margin_bottom = 21.0
theme = ExtResource( 10 )
text = "SCORE:"
[node name="ScoreCounter" type="Label" parent="."]
[node name="ScoreCounter" type="Label" parent="HUD"]
margin_left = 180.0
margin_top = 1.0
margin_right = 264.0

View file

@ -13,9 +13,9 @@ var axis = Vector2.ZERO
##Physics
var velocity = Vector2.ZERO
var walk_speed = 50
var gravity = 12.50
var gravity = 12
var jump_pressure = 0
var jump_force = 200
var jump_force = 150
var current_ladder = null
##Attacking
@ -49,7 +49,7 @@ func _physics_process(delta):
if current_state != State.CLIMB: velocity.y += gravity
#Apply velocity
move_and_slide(velocity,Vector2.UP)
print(velocity.y)
#Debug
if Input.is_action_pressed("debug_move_player"):
position = get_viewport().get_mouse_position()
@ -89,6 +89,7 @@ func _process_idle_walk():
func _process_jump():
jump_pressure += 1
move(walk_speed,0,true)
#Pressure sensitive jump
if jump_pressure == 15 or Input.is_action_just_released("jump"):
velocity.y = -jump_force / 4
@ -145,6 +146,7 @@ func check_jump():
position.x -= sprite.scale.x * 5
anims.set_speed_scale(1)
# Jump
velocity.y = 0
jump_pressure = 0
current_state = State.JUMP
Game.play_sound(Game.a_jump,Game.ac_jump)