mirror of
https://github.com/kristoferssolo/FuncIt.git
synced 2025-10-21 19:30:35 +00:00
Synced bullets
This commit is contained in:
commit
da3fb6b9d4
@ -41,42 +41,42 @@ fps=false
|
|||||||
|
|
||||||
input_right={
|
input_right={
|
||||||
"deadzone": 0.5,
|
"deadzone": 0.5,
|
||||||
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":68,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
|
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":68,"unicode":0,"echo":false,"script":null)
|
||||||
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777233,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
|
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777233,"unicode":0,"echo":false,"script":null)
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
input_left={
|
input_left={
|
||||||
"deadzone": 0.5,
|
"deadzone": 0.5,
|
||||||
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":65,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
|
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":65,"unicode":0,"echo":false,"script":null)
|
||||||
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777231,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
|
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777231,"unicode":0,"echo":false,"script":null)
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
input_up={
|
input_up={
|
||||||
"deadzone": 0.49,
|
"deadzone": 0.49,
|
||||||
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":87,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
|
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":87,"unicode":0,"echo":false,"script":null)
|
||||||
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777232,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
|
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777232,"unicode":0,"echo":false,"script":null)
|
||||||
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":32,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
|
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":32,"unicode":0,"echo":false,"script":null)
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
input_down={
|
input_down={
|
||||||
"deadzone": 0.5,
|
"deadzone": 0.5,
|
||||||
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":83,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
|
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":83,"unicode":0,"echo":false,"script":null)
|
||||||
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777234,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
|
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777234,"unicode":0,"echo":false,"script":null)
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
input_debug={
|
input_debug={
|
||||||
"deadzone": 0.5,
|
"deadzone": 0.5,
|
||||||
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":96,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
|
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":96,"unicode":0,"echo":false,"script":null)
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
input_enter={
|
input_enter={
|
||||||
"deadzone": 0.5,
|
"deadzone": 0.5,
|
||||||
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777221,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
|
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777221,"unicode":0,"echo":false,"script":null)
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
input_shift={
|
input_shift={
|
||||||
"deadzone": 0.5,
|
"deadzone": 0.5,
|
||||||
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777237,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
|
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777237,"unicode":0,"echo":false,"script":null)
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
input_shoot={
|
input_shoot={
|
||||||
@ -86,32 +86,32 @@ input_shoot={
|
|||||||
}
|
}
|
||||||
esc={
|
esc={
|
||||||
"deadzone": 0.5,
|
"deadzone": 0.5,
|
||||||
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777217,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
|
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777217,"unicode":0,"echo":false,"script":null)
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
rotation_increase={
|
rotation_increase={
|
||||||
"deadzone": 0.5,
|
"deadzone": 0.5,
|
||||||
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":69,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
|
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":69,"unicode":0,"echo":false,"script":null)
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
rotation_decrease={
|
rotation_decrease={
|
||||||
"deadzone": 0.5,
|
"deadzone": 0.5,
|
||||||
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":81,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
|
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":81,"unicode":0,"echo":false,"script":null)
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
line={
|
line={
|
||||||
"deadzone": 0.5,
|
"deadzone": 0.5,
|
||||||
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777351,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
|
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777351,"unicode":0,"echo":false,"script":null)
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
sine={
|
sine={
|
||||||
"deadzone": 0.5,
|
"deadzone": 0.5,
|
||||||
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777352,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
|
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777352,"unicode":0,"echo":false,"script":null)
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
hyper={
|
hyper={
|
||||||
"deadzone": 0.5,
|
"deadzone": 0.5,
|
||||||
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777353,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
|
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777353,"unicode":0,"echo":false,"script":null)
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
parab={
|
parab={
|
||||||
|
|||||||
@ -97,7 +97,6 @@ func _ready():
|
|||||||
if get_tree().has_network_peer():
|
if get_tree().has_network_peer():
|
||||||
if is_network_master():
|
if is_network_master():
|
||||||
Global.player_master = self
|
Global.player_master = self
|
||||||
|
|
||||||
# Allow update process override.
|
# Allow update process override.
|
||||||
set_process(true)
|
set_process(true)
|
||||||
$player_animated_sprite.play("idle")
|
$player_animated_sprite.play("idle")
|
||||||
@ -254,6 +253,7 @@ func _physics_process(delta) -> void:
|
|||||||
is_reloading = true
|
is_reloading = true
|
||||||
reload_timer.start()
|
reload_timer.start()
|
||||||
else:
|
else:
|
||||||
|
|
||||||
rotation = lerp_angle(rotation, puppet_rotation, delta * 8)
|
rotation = lerp_angle(rotation, puppet_rotation, delta * 8)
|
||||||
#rotation = puppet_rotation
|
#rotation = puppet_rotation
|
||||||
$"weaponHolder/Player-character-theme-gun".position = puppet_weapon_position
|
$"weaponHolder/Player-character-theme-gun".position = puppet_weapon_position
|
||||||
@ -269,6 +269,7 @@ func _physics_process(delta) -> void:
|
|||||||
$player_animated_sprite.play("idle-speed-"+direction+"-"+theme)
|
$player_animated_sprite.play("idle-speed-"+direction+"-"+theme)
|
||||||
$Particles2D.set_emitting(false)
|
$Particles2D.set_emitting(false)
|
||||||
rotate_weapon()
|
rotate_weapon()
|
||||||
|
|
||||||
if not tween.is_active():
|
if not tween.is_active():
|
||||||
pass
|
pass
|
||||||
if hp <= 0:
|
if hp <= 0:
|
||||||
@ -315,15 +316,6 @@ func _draw():
|
|||||||
draw_line(VDIR[v_t][v]["start"] - user_state["global_position"],(VDIR[v_t][v]["ray"]["position"] - user_state["global_position"]).rotated(-rotation),Color(255,255,255,1),1)
|
draw_line(VDIR[v_t][v]["start"] - user_state["global_position"],(VDIR[v_t][v]["ray"]["position"] - user_state["global_position"]).rotated(-rotation),Color(255,255,255,1),1)
|
||||||
|
|
||||||
|
|
||||||
func lerp_angle(from, to, weight):
|
|
||||||
return from + short_angle_dist(from, to) * weight
|
|
||||||
|
|
||||||
|
|
||||||
func short_angle_dist(from, to):
|
|
||||||
var max_angle = PI * 2
|
|
||||||
var difference = fmod(to - from, max_angle)
|
|
||||||
return fmod(2 * difference, max_angle) - difference
|
|
||||||
|
|
||||||
|
|
||||||
func puppet_position_set(new_value) -> void:
|
func puppet_position_set(new_value) -> void:
|
||||||
puppet_position = new_value
|
puppet_position = new_value
|
||||||
@ -417,6 +409,7 @@ sync func enable() -> void:
|
|||||||
visible = true
|
visible = true
|
||||||
$player_collider.disabled = false
|
$player_collider.disabled = false
|
||||||
$hitbox/CollisionShape2D.disabled = false
|
$hitbox/CollisionShape2D.disabled = false
|
||||||
|
$weaponHolder.disabled = false
|
||||||
|
|
||||||
if get_tree().has_network_peer():
|
if get_tree().has_network_peer():
|
||||||
if is_network_master():
|
if is_network_master():
|
||||||
@ -431,6 +424,7 @@ sync func destroy() -> void:
|
|||||||
visible = false
|
visible = false
|
||||||
$player_collider.disabled = true
|
$player_collider.disabled = true
|
||||||
$hitbox/CollisionShape2D.disabled = true
|
$hitbox/CollisionShape2D.disabled = true
|
||||||
|
$weaponHolder.disabled = true
|
||||||
Global.alive_players.erase(self)
|
Global.alive_players.erase(self)
|
||||||
|
|
||||||
if get_tree().has_network_peer():
|
if get_tree().has_network_peer():
|
||||||
|
|||||||
@ -3,20 +3,13 @@ extends AnimatedSprite
|
|||||||
var trajectory:String = 'line'
|
var trajectory:String = 'line'
|
||||||
var trajectory_line = 'line'
|
var trajectory_line = 'line'
|
||||||
|
|
||||||
var bullet_env = {
|
var bullet_trajectory = {
|
||||||
'line' : preload("res://source/entities/shooting/Line_Trajectory/Line_Env.tscn"),
|
'line' : preload("res://source/entities/shooting/Line_Trajectory/Line_Env.tscn"),
|
||||||
'sine' : preload("res://source/entities/shooting/Sine_Trajectory/Sine_Env.tscn"),
|
'sine' : preload("res://source/entities/shooting/Sine_Trajectory/Sine_Env.tscn"),
|
||||||
'parab' : preload("res://source/entities/shooting/Parabolic_Trajectory/Parabolic_Env.tscn"),
|
'parab' : preload("res://source/entities/shooting/Parabolic_Trajectory/Parabolic_Env.tscn"),
|
||||||
'hyper' : preload("res://source/entities/shooting/Hyperbolic_Trajectory/Hyperbolic_Env.tscn")
|
'hyper' : preload("res://source/entities/shooting/Hyperbolic_Trajectory/Hyperbolic_Env.tscn")
|
||||||
}
|
}
|
||||||
|
|
||||||
var bullet_trajectory = {
|
|
||||||
'line' : preload("res://source/entities/shooting/Line_Trajectory/Line_Barrel.tscn"),
|
|
||||||
'sine' : preload("res://source/entities/shooting/Sine_Trajectory/Sine_Barrel.tscn"),
|
|
||||||
'parab' : preload("res://source/entities/shooting/Parabolic_Trajectory/Parabolic_Barrel.tscn"),
|
|
||||||
'hyper' : preload("res://source/entities/shooting/Hyperbolic_Trajectory/Hyperbolic_Barrel.tscn")
|
|
||||||
}
|
|
||||||
|
|
||||||
func choose_trajectory():
|
func choose_trajectory():
|
||||||
if Input.is_action_just_pressed("line"):
|
if Input.is_action_just_pressed("line"):
|
||||||
trajectory = 'line'
|
trajectory = 'line'
|
||||||
@ -33,7 +26,7 @@ func choose_trajectory():
|
|||||||
|
|
||||||
|
|
||||||
func shoot(trajectory:String):
|
func shoot(trajectory:String):
|
||||||
var bullet = bullet_env[trajectory].instance()
|
var bullet = bullet_trajectory[trajectory].instance()
|
||||||
get_parent().get_parent().get_parent().add_child(bullet)
|
get_parent().get_parent().get_parent().add_child(bullet)
|
||||||
bullet.global_position = $Shooting_Point.global_position
|
bullet.global_position = $Shooting_Point.global_position
|
||||||
bullet.global_rotation = $Shooting_Point.global_rotation
|
bullet.global_rotation = $Shooting_Point.global_rotation
|
||||||
|
|||||||
@ -308,14 +308,14 @@ radius = 41.5403
|
|||||||
|
|
||||||
[sub_resource type="SpriteFrames" id=6]
|
[sub_resource type="SpriteFrames" id=6]
|
||||||
animations = [ {
|
animations = [ {
|
||||||
"frames": [ ExtResource( 168 ) ],
|
"frames": [ ExtResource( 170 ) ],
|
||||||
"loop": true,
|
"loop": true,
|
||||||
"name": "03",
|
"name": "02",
|
||||||
"speed": 5.0
|
"speed": 5.0
|
||||||
}, {
|
}, {
|
||||||
"frames": [ ExtResource( 170 ) ],
|
"frames": [ ExtResource( 170 ) ],
|
||||||
"loop": true,
|
"loop": true,
|
||||||
"name": "02",
|
"name": "03",
|
||||||
"speed": 5.0
|
"speed": 5.0
|
||||||
}, {
|
}, {
|
||||||
"frames": [ ExtResource( 169 ) ],
|
"frames": [ ExtResource( 169 ) ],
|
||||||
|
|||||||
@ -51,8 +51,8 @@ margin_left = -150.0
|
|||||||
margin_top = -36.0
|
margin_top = -36.0
|
||||||
margin_right = 150.0
|
margin_right = 150.0
|
||||||
margin_bottom = 36.0
|
margin_bottom = 36.0
|
||||||
custom_colors/font_color = Color( 0, 0, 0, 1 )
|
|
||||||
custom_fonts/font = ExtResource( 5 )
|
custom_fonts/font = ExtResource( 5 )
|
||||||
|
custom_colors/font_color = Color( 0, 0, 0, 1 )
|
||||||
text = "PLAY"
|
text = "PLAY"
|
||||||
align = 1
|
align = 1
|
||||||
valign = 1
|
valign = 1
|
||||||
@ -76,8 +76,8 @@ margin_left = -98.8223
|
|||||||
margin_top = -36.0
|
margin_top = -36.0
|
||||||
margin_right = 134.178
|
margin_right = 134.178
|
||||||
margin_bottom = 36.0
|
margin_bottom = 36.0
|
||||||
custom_colors/font_color = Color( 0, 0, 0, 1 )
|
|
||||||
custom_fonts/font = ExtResource( 5 )
|
custom_fonts/font = ExtResource( 5 )
|
||||||
|
custom_colors/font_color = Color( 0, 0, 0, 1 )
|
||||||
text = "LAN Party"
|
text = "LAN Party"
|
||||||
align = 1
|
align = 1
|
||||||
valign = 1
|
valign = 1
|
||||||
@ -108,8 +108,8 @@ margin_left = -150.0
|
|||||||
margin_top = -36.0
|
margin_top = -36.0
|
||||||
margin_right = 150.0
|
margin_right = 150.0
|
||||||
margin_bottom = 36.0
|
margin_bottom = 36.0
|
||||||
custom_colors/font_color = Color( 0, 0, 0, 1 )
|
|
||||||
custom_fonts/font = ExtResource( 5 )
|
custom_fonts/font = ExtResource( 5 )
|
||||||
|
custom_colors/font_color = Color( 0, 0, 0, 1 )
|
||||||
text = "EXIT"
|
text = "EXIT"
|
||||||
align = 1
|
align = 1
|
||||||
valign = 1
|
valign = 1
|
||||||
@ -123,8 +123,8 @@ margin_left = 1798.91
|
|||||||
margin_top = 989.536
|
margin_top = 989.536
|
||||||
margin_right = 1889.91
|
margin_right = 1889.91
|
||||||
margin_bottom = 1061.54
|
margin_bottom = 1061.54
|
||||||
custom_colors/font_color_disabled = Color( 1, 1, 1, 1 )
|
|
||||||
custom_fonts/font = ExtResource( 8 )
|
custom_fonts/font = ExtResource( 8 )
|
||||||
|
custom_colors/font_color_disabled = Color( 1, 1, 1, 1 )
|
||||||
__meta__ = {
|
__meta__ = {
|
||||||
"_edit_use_anchors_": false
|
"_edit_use_anchors_": false
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user