Browse Source

[Hero 2] Make gravity switch in multiplayer

master
Luna 7 years ago
parent
commit
1867d8afda
1 changed files with 5 additions and 5 deletions
  1. +5
    -5
      scripts/heroes/2.gd

+ 5
- 5
scripts/heroes/2.gd View File

@ -1,18 +1,18 @@
extends "res://scripts/player.gd"
#func _ready():
# get_node("Area").set_gravity_distance_scale(10)
var is_repelling = false
func _process(delta):
if is_network_master():
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())
rpc("switch_gravity")
is_repelling = !is_repelling
if is_repelling:
get_node("RepellingHUD").set_text("/\\")
else:
get_node("RepellingHUD").set_text("\\/")
sync func switch_gravity():
var area = get_node("Area")
area.set_gravity(-area.get_gravity())

Loading…
Cancel
Save