MP sync working, redoing all menus now

This commit is contained in:
2023-02-05 12:41:03 -05:00
parent d3dcbc153a
commit d7572b48cc
16 changed files with 330 additions and 73 deletions

View File

@@ -1,27 +1,34 @@
extends RigidBody2D
@onready var rigid_body = get_node(".")
@export var initial_impulse:Vector2 = Vector2(0,0)
@export var damage_speed:int = 50
@export var max_speed:int = 150
@export var push_strength:int = 20
@onready var last_velocity:Vector2 = Vector2(0,0)
@onready var current_player:CharacterBody2D = null
@export var initial_impulse:Vector2 = Vector2(0,0)
# Called when the node enters the scene tree for the first time.
func _ready():
print("Statue Ready!")
if initial_impulse != Vector2.ZERO:
rigid_body.apply_central_impulse(initial_impulse)
func _physics_process(delta):
last_velocity = get_linear_velocity()
if last_velocity.length() > damage_speed:
set_modulate(Color("8e2325"))
else:
set_modulate(Color("ffffff"))
if last_velocity.length() > max_speed:
set_linear_velocity(get_linear_velocity().normalized() * max_speed)
last_velocity.length()
func _on_body_entered(body):
print("body entered! ")
if body.is_in_group("player"):
print("Player collided!")
current_player = body
current_player.player_hit.is_player_hit = true
current_player.player_hit.hit_velocity = last_velocity
if last_velocity.x > 50 or last_velocity.y < -50 or last_velocity.x < -50 or last_velocity.y > 50:
if last_velocity.length() > damage_speed:
current_player = body
current_player.player_hit.is_player_hit = true
current_player.player_hit.hit_velocity = last_velocity.normalized() * push_strength
current_player.health_changed_func(-1)
rigid_body.set_sleeping(true)
# set_freeze_enabled(true)
# await get_tree().create_timer(0.5).timeout
set_sleeping(true)
# set_freeze_enabled(false)