Browse Source

Add repelling (toggle with E) to Hero 2

master
Luna 7 years ago
parent
commit
cf062334ba
3 changed files with 34 additions and 1 deletions
  1. +2
    -0
      project.godot
  2. +11
    -1
      scenes/heroes/2.gd
  3. +21
    -0
      scenes/heroes/2.tscn

+ 2
- 0
project.godot View File

@ -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]


+ 11
- 1
scenes/heroes/2.gd View File

@ -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())

+ 21
- 0
scenes/heroes/2.tscn View File

@ -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

Loading…
Cancel
Save