adjusted jump height
This commit is contained in:
parent
8f6a068eba
commit
28319efe0d
3 changed files with 22 additions and 16 deletions
|
@ -162,12 +162,11 @@ left_up_boundry = 3.0
|
||||||
right_down_boundry = 3.0
|
right_down_boundry = 3.0
|
||||||
speed = 35
|
speed = 35
|
||||||
|
|
||||||
[node name="ColorRect" type="ColorRect" parent="."]
|
[node name="ColorRect" type="ColorRect" parent="." groups=["debug"]]
|
||||||
margin_left = 256.0
|
margin_left = 256.0
|
||||||
margin_right = 512.0
|
margin_right = 512.0
|
||||||
margin_bottom = 192.0
|
margin_bottom = 192.0
|
||||||
color = Color( 0.87451, 0, 1, 0.0901961 )
|
color = Color( 0.87451, 0, 1, 0.0901961 )
|
||||||
script = ExtResource( 9 )
|
|
||||||
__meta__ = {
|
__meta__ = {
|
||||||
"_edit_lock_": true
|
"_edit_lock_": true
|
||||||
}
|
}
|
||||||
|
@ -189,3 +188,5 @@ margin_bottom = 8.0
|
||||||
color = Color( 0, 0, 0, 1 )
|
color = Color( 0, 0, 0, 1 )
|
||||||
|
|
||||||
[node name="HUD" parent="." instance=ExtResource( 6 )]
|
[node name="HUD" parent="." instance=ExtResource( 6 )]
|
||||||
|
|
||||||
|
[connection signal="ready" from="ColorRect" to="ColorRect" method="queue_free"]
|
||||||
|
|
|
@ -31,16 +31,19 @@ shader_param/palette = ExtResource( 8 )
|
||||||
shader = ExtResource( 1 )
|
shader = ExtResource( 1 )
|
||||||
shader_param/palette = ExtResource( 9 )
|
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_top = 1.0
|
||||||
margin_bottom = 1.0
|
margin_bottom = 1.0
|
||||||
script = ExtResource( 6 )
|
script = ExtResource( 6 )
|
||||||
|
|
||||||
[node name="Back" type="Sprite" parent="."]
|
[node name="Back" type="Sprite" parent="HUD"]
|
||||||
position = Vector2( 128, 8 )
|
position = Vector2( 128, 8 )
|
||||||
texture = ExtResource( 3 )
|
texture = ExtResource( 3 )
|
||||||
|
|
||||||
[node name="GoldCounter" type="Label" parent="."]
|
[node name="GoldCounter" type="Label" parent="HUD"]
|
||||||
margin_left = 14.0
|
margin_left = 14.0
|
||||||
margin_top = 1.0
|
margin_top = 1.0
|
||||||
margin_right = 54.0
|
margin_right = 54.0
|
||||||
|
@ -48,7 +51,7 @@ margin_bottom = 21.0
|
||||||
theme = ExtResource( 10 )
|
theme = ExtResource( 10 )
|
||||||
text = "000"
|
text = "000"
|
||||||
|
|
||||||
[node name="ShardCounter" type="Label" parent="."]
|
[node name="ShardCounter" type="Label" parent="HUD"]
|
||||||
margin_left = 53.0
|
margin_left = 53.0
|
||||||
margin_top = 1.0
|
margin_top = 1.0
|
||||||
margin_right = 93.0
|
margin_right = 93.0
|
||||||
|
@ -56,7 +59,7 @@ margin_bottom = 21.0
|
||||||
theme = ExtResource( 10 )
|
theme = ExtResource( 10 )
|
||||||
text = "00"
|
text = "00"
|
||||||
|
|
||||||
[node name="RedStar" type="Sprite" parent="."]
|
[node name="RedStar" type="Sprite" parent="HUD"]
|
||||||
visible = false
|
visible = false
|
||||||
material = SubResource( 1 )
|
material = SubResource( 1 )
|
||||||
position = Vector2( 79, 8 )
|
position = Vector2( 79, 8 )
|
||||||
|
@ -64,7 +67,7 @@ texture = ExtResource( 4 )
|
||||||
region_enabled = true
|
region_enabled = true
|
||||||
region_rect = Rect2( 0, 0, 11, 11 )
|
region_rect = Rect2( 0, 0, 11, 11 )
|
||||||
|
|
||||||
[node name="YellowStar" type="Sprite" parent="."]
|
[node name="YellowStar" type="Sprite" parent="HUD"]
|
||||||
visible = false
|
visible = false
|
||||||
material = SubResource( 2 )
|
material = SubResource( 2 )
|
||||||
position = Vector2( 92, 8 )
|
position = Vector2( 92, 8 )
|
||||||
|
@ -72,7 +75,7 @@ texture = ExtResource( 4 )
|
||||||
region_enabled = true
|
region_enabled = true
|
||||||
region_rect = Rect2( 0, 0, 11, 11 )
|
region_rect = Rect2( 0, 0, 11, 11 )
|
||||||
|
|
||||||
[node name="GreenStar" type="Sprite" parent="."]
|
[node name="GreenStar" type="Sprite" parent="HUD"]
|
||||||
visible = false
|
visible = false
|
||||||
material = SubResource( 3 )
|
material = SubResource( 3 )
|
||||||
position = Vector2( 105, 8 )
|
position = Vector2( 105, 8 )
|
||||||
|
@ -80,7 +83,7 @@ texture = ExtResource( 4 )
|
||||||
region_enabled = true
|
region_enabled = true
|
||||||
region_rect = Rect2( 0, 0, 11, 11 )
|
region_rect = Rect2( 0, 0, 11, 11 )
|
||||||
|
|
||||||
[node name="BlueStar" type="Sprite" parent="."]
|
[node name="BlueStar" type="Sprite" parent="HUD"]
|
||||||
visible = false
|
visible = false
|
||||||
material = SubResource( 4 )
|
material = SubResource( 4 )
|
||||||
position = Vector2( 118, 8 )
|
position = Vector2( 118, 8 )
|
||||||
|
@ -88,7 +91,7 @@ texture = ExtResource( 4 )
|
||||||
region_enabled = true
|
region_enabled = true
|
||||||
region_rect = Rect2( 0, 0, 11, 11 )
|
region_rect = Rect2( 0, 0, 11, 11 )
|
||||||
|
|
||||||
[node name="MagentaStar" type="Sprite" parent="."]
|
[node name="MagentaStar" type="Sprite" parent="HUD"]
|
||||||
visible = false
|
visible = false
|
||||||
material = SubResource( 5 )
|
material = SubResource( 5 )
|
||||||
position = Vector2( 131, 8 )
|
position = Vector2( 131, 8 )
|
||||||
|
@ -96,7 +99,7 @@ texture = ExtResource( 4 )
|
||||||
region_enabled = true
|
region_enabled = true
|
||||||
region_rect = Rect2( 0, 0, 11, 11 )
|
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_left = 142.0
|
||||||
margin_top = 1.0
|
margin_top = 1.0
|
||||||
margin_right = 226.0
|
margin_right = 226.0
|
||||||
|
@ -104,7 +107,7 @@ margin_bottom = 21.0
|
||||||
theme = ExtResource( 10 )
|
theme = ExtResource( 10 )
|
||||||
text = "SCORE:"
|
text = "SCORE:"
|
||||||
|
|
||||||
[node name="ScoreCounter" type="Label" parent="."]
|
[node name="ScoreCounter" type="Label" parent="HUD"]
|
||||||
margin_left = 180.0
|
margin_left = 180.0
|
||||||
margin_top = 1.0
|
margin_top = 1.0
|
||||||
margin_right = 264.0
|
margin_right = 264.0
|
||||||
|
|
|
@ -13,9 +13,9 @@ var axis = Vector2.ZERO
|
||||||
##Physics
|
##Physics
|
||||||
var velocity = Vector2.ZERO
|
var velocity = Vector2.ZERO
|
||||||
var walk_speed = 50
|
var walk_speed = 50
|
||||||
var gravity = 12.50
|
var gravity = 12
|
||||||
var jump_pressure = 0
|
var jump_pressure = 0
|
||||||
var jump_force = 200
|
var jump_force = 150
|
||||||
var current_ladder = null
|
var current_ladder = null
|
||||||
##Attacking
|
##Attacking
|
||||||
|
|
||||||
|
@ -49,7 +49,7 @@ func _physics_process(delta):
|
||||||
if current_state != State.CLIMB: velocity.y += gravity
|
if current_state != State.CLIMB: velocity.y += gravity
|
||||||
#Apply velocity
|
#Apply velocity
|
||||||
move_and_slide(velocity,Vector2.UP)
|
move_and_slide(velocity,Vector2.UP)
|
||||||
|
print(velocity.y)
|
||||||
#Debug
|
#Debug
|
||||||
if Input.is_action_pressed("debug_move_player"):
|
if Input.is_action_pressed("debug_move_player"):
|
||||||
position = get_viewport().get_mouse_position()
|
position = get_viewport().get_mouse_position()
|
||||||
|
@ -89,6 +89,7 @@ func _process_idle_walk():
|
||||||
|
|
||||||
func _process_jump():
|
func _process_jump():
|
||||||
jump_pressure += 1
|
jump_pressure += 1
|
||||||
|
move(walk_speed,0,true)
|
||||||
#Pressure sensitive jump
|
#Pressure sensitive jump
|
||||||
if jump_pressure == 15 or Input.is_action_just_released("jump"):
|
if jump_pressure == 15 or Input.is_action_just_released("jump"):
|
||||||
velocity.y = -jump_force / 4
|
velocity.y = -jump_force / 4
|
||||||
|
@ -145,6 +146,7 @@ func check_jump():
|
||||||
position.x -= sprite.scale.x * 5
|
position.x -= sprite.scale.x * 5
|
||||||
anims.set_speed_scale(1)
|
anims.set_speed_scale(1)
|
||||||
# Jump
|
# Jump
|
||||||
|
velocity.y = 0
|
||||||
jump_pressure = 0
|
jump_pressure = 0
|
||||||
current_state = State.JUMP
|
current_state = State.JUMP
|
||||||
Game.play_sound(Game.a_jump,Game.ac_jump)
|
Game.play_sound(Game.a_jump,Game.ac_jump)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue