mirror of
https://github.com/kristoferssolo/FuncIt.git
synced 2025-10-21 19:30:35 +00:00
Fixed crash on spawning
This commit is contained in:
parent
99f1839589
commit
cd669f47f5
@ -1,24 +1,14 @@
|
||||
extends Sprite
|
||||
|
||||
export(int) var speed = 100
|
||||
var velocity = Vector2(1, 0)
|
||||
|
||||
var time = 0
|
||||
export var amplitude = 4
|
||||
export var frequency = 5
|
||||
var gravitile = 5
|
||||
|
||||
|
||||
#var velocity = Vector2(1, 0)
|
||||
var player_rotation
|
||||
|
||||
#export(int) var speed = 1400
|
||||
export(int) var speed = 1400
|
||||
export(int) var damage = 25
|
||||
|
||||
puppet var puppet_position setget puppet_position_set
|
||||
puppet var puppet_velocity = Vector2(0, 0)
|
||||
puppet var puppet_rotation = 0
|
||||
puppet var bullet_position setget bullet_position_set
|
||||
|
||||
onready var initial_position = global_position
|
||||
|
||||
@ -34,9 +24,8 @@ func _ready() -> void:
|
||||
velocity = velocity.rotated(player_rotation)
|
||||
rotation = player_rotation
|
||||
rset("puppet_velocity", velocity)
|
||||
#rset("puppet_rotation", rotation)
|
||||
rset("puppet_rotation", rotation)
|
||||
rset("puppet_position", global_position)
|
||||
rset("bullet_position", bullet_position)
|
||||
|
||||
visible = true
|
||||
|
||||
@ -44,9 +33,6 @@ func _ready() -> void:
|
||||
func _process(delta: float) -> void:
|
||||
if get_tree().has_network_peer():
|
||||
if is_network_master():
|
||||
follow_sine_trajectory()
|
||||
time += delta
|
||||
#global_position += velocity * speed * delta
|
||||
global_position += velocity * speed * delta
|
||||
else:
|
||||
rotation = puppet_rotation
|
||||
@ -58,45 +44,11 @@ func puppet_position_set(new_value) -> void:
|
||||
global_position = puppet_position
|
||||
|
||||
|
||||
func bullet_position_set(new_value) -> void:
|
||||
bullet_position = new_value
|
||||
global_position = bullet_position
|
||||
|
||||
|
||||
sync func destroy() -> void:
|
||||
queue_free()
|
||||
|
||||
|
||||
func _on_destroy_timer_timeout():
|
||||
func _on_Destroy_timer_timeout():
|
||||
if get_tree().has_network_peer():
|
||||
if get_tree().is_network_server():
|
||||
rpc("destroy")
|
||||
|
||||
|
||||
func follow_line_trajectory():
|
||||
velocity = Vector2(1, 0) * 10
|
||||
|
||||
|
||||
func follow_sine_trajectory():
|
||||
velocity.y = amplitude * cos(time * frequency)
|
||||
velocity.x = 5
|
||||
|
||||
|
||||
func follow_parabolic_trajectory():
|
||||
velocity.x = 5
|
||||
velocity.y = 1 * time * gravitile
|
||||
|
||||
|
||||
func follow_n_parabolic_trajectory():
|
||||
velocity.x = 5
|
||||
velocity.y = -1 * time * gravitile
|
||||
|
||||
|
||||
func follow_hyperbolic_trajectory():
|
||||
velocity.x = gravitile * time
|
||||
velocity.y = 1
|
||||
|
||||
|
||||
func follow_n_hyperbolic_trajectory():
|
||||
velocity.x = gravitile * time
|
||||
velocity.y = -1
|
||||
|
||||
@ -103,6 +103,20 @@ __meta__ = {
|
||||
position = Vector2( 960, 1096 )
|
||||
scale = Vector2( 2, 1 )
|
||||
|
||||
[node name="spawn_locations" type="Node" parent="."]
|
||||
|
||||
[node name="1" type="Position2D" parent="spawn_locations"]
|
||||
position = Vector2( 264, 880 )
|
||||
|
||||
[node name="2" type="Position2D" parent="spawn_locations"]
|
||||
position = Vector2( 688, 912 )
|
||||
|
||||
[node name="3" type="Position2D" parent="spawn_locations"]
|
||||
position = Vector2( 1264, 872 )
|
||||
|
||||
[node name="4" type="Position2D" parent="spawn_locations"]
|
||||
position = Vector2( 1584, 888 )
|
||||
|
||||
[connection signal="pressed" from="multiplayer_configure/create_server" to="." method="_on_create_server_pressed"]
|
||||
[connection signal="pressed" from="multiplayer_configure/join_server" to="." method="_on_join_server_pressed"]
|
||||
[connection signal="pressed" from="UI/start_game" to="." method="_on_start_game_pressed"]
|
||||
|
||||
Loading…
Reference in New Issue
Block a user