diff --git a/project.godot b/project.godot index 3e3b303..c514a24 100644 --- a/project.godot +++ b/project.godot @@ -32,6 +32,8 @@ hero_1_place_wall=[ Object(InputEventKey,"resource_local_to_scene":false,"resour ] hero_1_confirm_wall=[ Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"button_mask":0,"position":Vector2( 0, 0 ),"global_position":Vector2( 0, 0 ),"factor":1.0,"button_index":1,"pressed":false,"doubleclick":false,"script":null) ] +hero_2_switch_gravity=[ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":46,"unicode":0,"echo":false,"script":null) + ] [rendering] diff --git a/scenes/heroes/2.gd b/scenes/heroes/2.gd index cfd116d..4224eae 100644 --- a/scenes/heroes/2.gd +++ b/scenes/heroes/2.gd @@ -3,6 +3,16 @@ extends "res://scripts/player.gd" #func _ready(): # get_node("Area").set_gravity_distance_scale(10) +var is_repelling = false + func _process(delta): - print(get_translation()) + if Input.is_action_just_pressed("hero_2_switch_gravity"): + # Press button twice to cancel + var area = get_node("Area") + area.set_gravity(-area.get_gravity()) + is_repelling = !is_repelling + if is_repelling: + get_node("RepellingHUD").set_text("/\\") + else: + get_node("RepellingHUD").set_text("\\/") #get_node("Area").set_gravity_vector(get_translation()) diff --git a/scenes/heroes/2.tscn b/scenes/heroes/2.tscn index 929b9d6..f2b589d 100644 --- a/scenes/heroes/2.tscn +++ b/scenes/heroes/2.tscn @@ -176,4 +176,25 @@ _sections_unfolded = [ "Audio Bus", "Collision", "Pause", "Reverb Bus", "Transfo shape = SubResource( 4 ) disabled = false +[node name="RepellingHUD" type="Label" parent="." index="7"] + +anchor_left = 0.5 +anchor_top = 0.5 +anchor_right = 0.5 +anchor_bottom = 0.5 +margin_left = -20.0 +margin_top = -34.0 +margin_right = 20.0 +margin_bottom = -20.0 +rect_pivot_offset = Vector2( 0, 0 ) +mouse_filter = 2 +mouse_default_cursor_shape = 0 +size_flags_horizontal = 1 +size_flags_vertical = 4 +text = "\\/" +align = 1 +percent_visible = 1.0 +lines_skipped = 0 +max_lines_visible = -1 +