final is here
This commit is contained in:
BIN
assets/1643870183089_HD.png
LFS
Normal file
BIN
assets/1643870183089_HD.png
LFS
Normal file
Binary file not shown.
34
assets/1643870183089_HD.png.import
Normal file
34
assets/1643870183089_HD.png.import
Normal file
@@ -0,0 +1,34 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://bectm2xcneqpx"
|
||||
path="res://.godot/imported/1643870183089_HD.png-3b635968481e0dcc87a3982c2efabee1.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://assets/1643870183089_HD.png"
|
||||
dest_files=["res://.godot/imported/1643870183089_HD.png-3b635968481e0dcc87a3982c2efabee1.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
||||
@@ -1,11 +1,10 @@
|
||||
extends Node
|
||||
|
||||
signal player_hit
|
||||
|
||||
signal player_hit(bool)
|
||||
signal start_game_one_player
|
||||
signal start_game_two_player
|
||||
signal go_to_menu(String)
|
||||
signal point_gain(int)
|
||||
signal point_gain(int, Vector2)
|
||||
signal go_to_score_saver(int)
|
||||
|
||||
var is_multiplayer := false
|
||||
@@ -31,7 +30,6 @@ func start_two_player()->void:
|
||||
get_tree().change_scene_to_file("res://scene/main_game_2_player.tscn")
|
||||
|
||||
func start_menu(user_name : String)->void:
|
||||
printt(user_name, actual_score)
|
||||
if is_multiplayer:
|
||||
var temp = score.score_multiplayer.get(user_name, -1.0)
|
||||
if temp < actual_score:
|
||||
@@ -43,7 +41,6 @@ func start_menu(user_name : String)->void:
|
||||
user_name = ""
|
||||
actual_score = 0
|
||||
is_multiplayer = false
|
||||
print(score.score_singleplayer)
|
||||
score.save()
|
||||
get_tree().call_deferred("change_scene_to_file", "res://scene/load_screen.tscn")
|
||||
|
||||
|
||||
@@ -13,6 +13,9 @@ config_version=5
|
||||
config/name="asteroid"
|
||||
run/main_scene="uid://jx8hrj6k1ju8"
|
||||
config/features=PackedStringArray("4.4", "Forward Plus")
|
||||
boot_splash/bg_color=Color(0, 0, 0, 1)
|
||||
boot_splash/use_filter=false
|
||||
boot_splash/image="uid://bectm2xcneqpx"
|
||||
config/icon="res://icon.svg"
|
||||
|
||||
[autoload]
|
||||
@@ -23,49 +26,78 @@ GameController="*res://game_controller.gd"
|
||||
|
||||
window/size/viewport_width=640
|
||||
window/size/viewport_height=640
|
||||
window/size/mode=3
|
||||
window/stretch/mode="viewport"
|
||||
window/stretch/scale_mode="integer"
|
||||
window/vsync/vsync_mode=0
|
||||
|
||||
[input]
|
||||
|
||||
ui_accept={
|
||||
"deadzone": 0.5,
|
||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":4194309,"physical_keycode":0,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
|
||||
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":4194310,"physical_keycode":0,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
|
||||
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":32,"physical_keycode":0,"key_label":0,"unicode":32,"location":0,"echo":false,"script":null)
|
||||
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":0,"pressure":0.0,"pressed":true,"script":null)
|
||||
]
|
||||
}
|
||||
ui_left={
|
||||
"deadzone": 0.5,
|
||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":4194319,"physical_keycode":0,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
|
||||
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":13,"pressure":0.0,"pressed":false,"script":null)
|
||||
"events": [Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":13,"pressure":0.0,"pressed":false,"script":null)
|
||||
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":0,"axis":0,"axis_value":-1.0,"script":null)
|
||||
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":65,"key_label":0,"unicode":97,"location":0,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
ui_right={
|
||||
"deadzone": 0.5,
|
||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":4194321,"physical_keycode":0,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
|
||||
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":14,"pressure":0.0,"pressed":false,"script":null)
|
||||
"events": [Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":14,"pressure":0.0,"pressed":false,"script":null)
|
||||
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":0,"axis":0,"axis_value":1.0,"script":null)
|
||||
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":68,"key_label":0,"unicode":100,"location":0,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
ui_up={
|
||||
"deadzone": 0.5,
|
||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":4194320,"physical_keycode":0,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
|
||||
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":11,"pressure":0.0,"pressed":false,"script":null)
|
||||
"events": [Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":11,"pressure":0.0,"pressed":false,"script":null)
|
||||
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":0,"axis":1,"axis_value":-1.0,"script":null)
|
||||
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":87,"key_label":0,"unicode":119,"location":0,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
ui_down={
|
||||
"deadzone": 0.5,
|
||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":4194322,"physical_keycode":0,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
|
||||
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":12,"pressure":0.0,"pressed":false,"script":null)
|
||||
"events": [Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":12,"pressure":0.0,"pressed":false,"script":null)
|
||||
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":0,"axis":1,"axis_value":1.0,"script":null)
|
||||
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":83,"key_label":0,"unicode":115,"location":0,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
up_player_2={
|
||||
"deadzone": 0.2,
|
||||
"events": [Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":1,"axis":1,"axis_value":-1.0,"script":null)
|
||||
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194320,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
down_player_2={
|
||||
"deadzone": 0.2,
|
||||
"events": [Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":1,"axis":1,"axis_value":1.0,"script":null)
|
||||
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194322,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
left_player_2={
|
||||
"deadzone": 0.2,
|
||||
"events": [Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":1,"axis":0,"axis_value":-1.0,"script":null)
|
||||
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194319,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
right_player_2={
|
||||
"deadzone": 0.2,
|
||||
"events": [Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":1,"axis":0,"axis_value":1.0,"script":null)
|
||||
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194321,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
accept_player_2={
|
||||
"deadzone": 0.2,
|
||||
"events": [Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":1,"button_index":0,"pressure":0.0,"pressed":false,"script":null)
|
||||
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194326,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
|
||||
[physics]
|
||||
|
||||
@@ -74,3 +106,5 @@ ui_down={
|
||||
[rendering]
|
||||
|
||||
textures/canvas_textures/default_texture_filter=0
|
||||
renderer/rendering_method="gl_compatibility"
|
||||
renderer/rendering_method.mobile="gl_compatibility"
|
||||
|
||||
@@ -11,8 +11,8 @@ colors = PackedColorArray(1, 1, 1, 1, 1, 1, 1, 0.772549, 1, 1, 1, 0)
|
||||
emitting = false
|
||||
amount = 16
|
||||
texture = ExtResource("1_4xjek")
|
||||
lifetime = 2.5
|
||||
one_shot = true
|
||||
speed_scale = 2.0
|
||||
explosiveness = 0.5
|
||||
randomness = 0.46
|
||||
spread = 180.0
|
||||
|
||||
@@ -43,9 +43,12 @@ func _ready() -> void:
|
||||
|
||||
# Trier par ordre alphabétique
|
||||
tableau_paires.sort_custom(func(a, b): return a[\"value\"] > b[\"value\"])
|
||||
text += \" 1 Player\"
|
||||
text += \" 1 Player\"
|
||||
for i in range(clamp(5, 0, tableau_paires.size())):
|
||||
text += \"\\n\" + tableau_paires[i][\"key\"] + \" : \" + str(tableau_paires[i][\"value\"])
|
||||
text += \"\\n\" + str(i+1) + \"e \" + tableau_paires[i][\"key\"] + \" : \" + str(tableau_paires[i][\"value\"])
|
||||
if tableau_paires.size() < 5:
|
||||
for i in range(5 - tableau_paires.size()):
|
||||
text += \"\\n\" + str(tableau_paires.size()+ i+1) + \"e \" + \"---- : ----\"
|
||||
"
|
||||
|
||||
[sub_resource type="GDScript" id="GDScript_u3kfb"]
|
||||
@@ -53,14 +56,16 @@ script/source = "extends Label
|
||||
func _ready() -> void:
|
||||
var tableau_paires = []
|
||||
for key in GameController.score.score_multiplayer:
|
||||
print(key)
|
||||
tableau_paires.append({\"key\": key, \"value\": GameController.score.score_multiplayer[key]})
|
||||
|
||||
# Trier par ordre alphabétique
|
||||
tableau_paires.sort_custom(func(a, b): return a[\"value\"] > b[\"value\"])
|
||||
text += \" 2 Players\"
|
||||
text += \" 2 Players\"
|
||||
for i in range(clamp(5, 0, tableau_paires.size())):
|
||||
text += \"\\n\" + tableau_paires[i][\"key\"] + \" : \" + str(tableau_paires[i][\"value\"])
|
||||
text += \"\\n\" + str(i+1) + \"e \" + tableau_paires[i][\"key\"] + \" : \" + str(tableau_paires[i][\"value\"])
|
||||
if tableau_paires.size() < 5:
|
||||
for i in range(5 - tableau_paires.size()):
|
||||
text += \"\\n\" + str(tableau_paires.size()+ i+1) + \"e \" + \"---- : ----\"
|
||||
"
|
||||
|
||||
[node name="load_screen" type="Node2D"]
|
||||
@@ -82,9 +87,11 @@ load_screen = true
|
||||
|
||||
[node name="Control" type="Control" parent="CanvasLayer"]
|
||||
layout_mode = 3
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
anchors_preset = 8
|
||||
anchor_left = 0.5
|
||||
anchor_top = 0.5
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 0.5
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
|
||||
@@ -95,10 +102,10 @@ anchor_left = 0.5
|
||||
anchor_top = 0.5
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 0.5
|
||||
offset_left = -75.5
|
||||
offset_top = -55.0
|
||||
offset_right = 75.5
|
||||
offset_bottom = 55.0
|
||||
offset_left = -119.5
|
||||
offset_top = -64.0
|
||||
offset_right = 119.5
|
||||
offset_bottom = 64.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
theme_override_constants/separation = 64
|
||||
@@ -137,16 +144,19 @@ script = SubResource("GDScript_7iavl")
|
||||
|
||||
[node name="scores" type="VBoxContainer" parent="CanvasLayer/Control/HBoxContainer"]
|
||||
layout_mode = 2
|
||||
theme = ExtResource("3_7iavl")
|
||||
theme_override_constants/separation = 64
|
||||
|
||||
[node name="Label" type="Label" parent="CanvasLayer/Control/HBoxContainer/scores"]
|
||||
layout_mode = 2
|
||||
theme = ExtResource("3_7iavl")
|
||||
theme_override_font_sizes/font_size = 16
|
||||
script = SubResource("GDScript_dogtj")
|
||||
|
||||
[node name="Label2" type="Label" parent="CanvasLayer/Control/HBoxContainer/scores"]
|
||||
layout_mode = 2
|
||||
theme = ExtResource("3_7iavl")
|
||||
theme_override_font_sizes/font_size = 16
|
||||
script = SubResource("GDScript_u3kfb")
|
||||
|
||||
[connection signal="pressed" from="CanvasLayer/Control/HBoxContainer/buttons/1" to="CanvasLayer/Control/HBoxContainer/buttons/1" method="_on_pressed"]
|
||||
|
||||
@@ -19,6 +19,7 @@ rotation = -1.5708
|
||||
[node name="CharacterBody2D2" parent="." instance=ExtResource("2_xilri")]
|
||||
position = Vector2(115, -33)
|
||||
rotation = -1.5708
|
||||
player_2 = true
|
||||
|
||||
[node name="spawner" parent="." node_paths=PackedStringArray("player") instance=ExtResource("3_hepd6")]
|
||||
player = NodePath("../CharacterBody2D")
|
||||
|
||||
52
scene/score_particles.tscn
Normal file
52
scene/score_particles.tscn
Normal file
@@ -0,0 +1,52 @@
|
||||
[gd_scene load_steps=6 format=3 uid="uid://hdekde5crm8g"]
|
||||
|
||||
[ext_resource type="Theme" uid="uid://b46gto6k33wqr" path="res://theme.tres" id="1_g3ehp"]
|
||||
[ext_resource type="Script" uid="uid://5cghvv2m23uq" path="res://script/score_particles.gd" id="1_yb0l5"]
|
||||
|
||||
[sub_resource type="ViewportTexture" id="ViewportTexture_yb0l5"]
|
||||
viewport_path = NodePath("SubViewport")
|
||||
|
||||
[sub_resource type="Curve" id="Curve_g3ehp"]
|
||||
_data = [Vector2(0, 0), 0.0, 0.0, 0, 0, Vector2(0.0695971, 1), 4.42277, 4.42277, 0, 0, Vector2(0.267399, 1), -2.49704, -2.49704, 0, 0, Vector2(1, 0), 0.0, 0.0, 0, 0]
|
||||
point_count = 4
|
||||
|
||||
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_fmxq6"]
|
||||
|
||||
[node name="score_particles" type="CPUParticles2D" node_paths=PackedStringArray("label")]
|
||||
emitting = false
|
||||
amount = 1
|
||||
texture = SubResource("ViewportTexture_yb0l5")
|
||||
lifetime = 2.5
|
||||
one_shot = true
|
||||
randomness = 1.0
|
||||
direction = Vector2(100, 0)
|
||||
spread = 180.0
|
||||
gravity = Vector2(0, 0)
|
||||
initial_velocity_min = 50.0
|
||||
initial_velocity_max = 100.0
|
||||
angular_velocity_min = -20.0
|
||||
angular_velocity_max = 20.0
|
||||
linear_accel_max = 50.0
|
||||
scale_amount_curve = SubResource("Curve_g3ehp")
|
||||
script = ExtResource("1_yb0l5")
|
||||
label = NodePath("SubViewport/Label")
|
||||
|
||||
[node name="SubViewport" type="SubViewport" parent="."]
|
||||
transparent_bg = true
|
||||
size = Vector2i(640, 32)
|
||||
|
||||
[node name="Label" type="Label" parent="SubViewport"]
|
||||
anchors_preset = 8
|
||||
anchor_left = 0.5
|
||||
anchor_top = 0.5
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 0.5
|
||||
offset_left = -18.0
|
||||
offset_top = -16.0
|
||||
offset_right = 18.0
|
||||
offset_bottom = 16.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
theme = ExtResource("1_g3ehp")
|
||||
theme_override_styles/normal = SubResource("StyleBoxEmpty_fmxq6")
|
||||
text = "+23"
|
||||
@@ -31,8 +31,8 @@ grow_vertical = 2
|
||||
|
||||
[node name="ItemList" type="ItemList" parent="Control"]
|
||||
layout_mode = 0
|
||||
offset_top = 425.0
|
||||
offset_right = 641.0
|
||||
offset_top = 426.0
|
||||
offset_right = 640.0
|
||||
offset_bottom = 640.0
|
||||
theme = ExtResource("1_sa1is")
|
||||
auto_width = true
|
||||
@@ -82,11 +82,15 @@ script = SubResource("GDScript_sa1is")
|
||||
|
||||
[node name="Label" type="Label" parent="Control"]
|
||||
layout_mode = 1
|
||||
offset_right = 463.0
|
||||
offset_bottom = 160.0
|
||||
offset_left = 2.0
|
||||
offset_top = 2.0
|
||||
offset_right = 638.0
|
||||
offset_bottom = 424.0
|
||||
theme = ExtResource("1_sa1is")
|
||||
theme_override_font_sizes/font_size = 64
|
||||
text = "Player Name 0/15:"
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
|
||||
[connection signal="item_activated" from="Control/ItemList" to="." method="_on_item_list_item_activated"]
|
||||
[connection signal="item_selected" from="Control/ItemList" to="." method="_on_item_list_item_selected"]
|
||||
|
||||
@@ -42,6 +42,7 @@ _data = {
|
||||
}
|
||||
|
||||
[node name="CharacterBody2D" type="CharacterBody2D" node_paths=PackedStringArray("animation", "target")]
|
||||
collision_priority = 100.0
|
||||
script = ExtResource("1_4cq66")
|
||||
SHOOT_NODE = ExtResource("2_v4325")
|
||||
TIME_INVUL = 2.0
|
||||
@@ -60,6 +61,7 @@ libraries = {
|
||||
|
||||
[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="."]
|
||||
polygon = PackedVector2Array(14, 2, 14, -2, -9, -10, -13, -10, -14, -9, -14, 8, -13, 9, -9, 9)
|
||||
one_way_collision_margin = 10.0
|
||||
|
||||
[node name="Node2D" type="Node2D" parent="."]
|
||||
position = Vector2(15, 0)
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
[ext_resource type="Script" uid="uid://dsd0opfd8kyow" path="res://script/shoot.gd" id="1_vnmmp"]
|
||||
|
||||
[sub_resource type="CircleShape2D" id="CircleShape2D_yt1ub"]
|
||||
radius = 5.0
|
||||
radius = 4.0
|
||||
|
||||
[node name="shoot" type="RigidBody2D"]
|
||||
collision_layer = 2
|
||||
@@ -16,9 +16,8 @@ SPEED = 400.0
|
||||
|
||||
[node name="Sprite2D" type="Sprite2D" parent="."]
|
||||
texture_filter = 1
|
||||
position = Vector2(0.4, 0.565)
|
||||
texture = ExtResource("1_ttj7r")
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||
shape = SubResource("CircleShape2D_yt1ub")
|
||||
|
||||
[connection signal="body_entered" from="." to="." method="_on_body_entered"]
|
||||
|
||||
@@ -61,8 +61,10 @@ anchor_left = 1.0
|
||||
anchor_top = 1.0
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
offset_left = -40.0
|
||||
offset_top = -23.0
|
||||
offset_left = -29.0
|
||||
offset_top = -38.0
|
||||
offset_right = -2.0
|
||||
offset_bottom = -2.0
|
||||
grow_horizontal = 0
|
||||
grow_vertical = 0
|
||||
theme = ExtResource("1_s2f8l")
|
||||
|
||||
@@ -8,6 +8,7 @@ var delay_dup := 0.0
|
||||
|
||||
@export var particles := load("res://scene/destroy.tscn")
|
||||
|
||||
|
||||
@export var asteroidx1 : = load("res://scene/asteroidx1.tscn")
|
||||
@export var asteroidx2 : = load("res://scene/asteroidx2.tscn")
|
||||
@export var asteroidx3 : = load("res://scene/asteroidx3.tscn")
|
||||
@@ -65,10 +66,12 @@ func _on_body_entered(body: Node) -> void:
|
||||
elif body.is_in_group("shoot"):
|
||||
body.destroy = true
|
||||
body.queue_free()
|
||||
GameController.emit_signal("point_gain", type)
|
||||
GameController.emit_signal("point_gain", type, global_position)
|
||||
split()
|
||||
elif body is Ship and !body.is_inv():
|
||||
body.is_currently_hit = true
|
||||
direction = (global_position - body.global_position).normalized()
|
||||
body.velocity += direction * 10
|
||||
#GameController.emit_signal("player_hit")
|
||||
|
||||
|
||||
|
||||
14
script/score_particles.gd
Normal file
14
script/score_particles.gd
Normal file
@@ -0,0 +1,14 @@
|
||||
extends CPUParticles2D
|
||||
|
||||
|
||||
@export var label := Label
|
||||
|
||||
var score := 0
|
||||
|
||||
func _ready() -> void:
|
||||
emitting = true
|
||||
label.text = "+" + str(score)
|
||||
|
||||
func _process(delta: float) -> void:
|
||||
if not emitting:
|
||||
queue_free()
|
||||
1
script/score_particles.gd.uid
Normal file
1
script/score_particles.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://5cghvv2m23uq
|
||||
@@ -5,18 +5,28 @@ var player_name := ""
|
||||
@export var label_name := Label
|
||||
|
||||
|
||||
func _on_item_list_item_selected(index: int) -> void:
|
||||
pass
|
||||
func _ready() -> void:
|
||||
if GameController.is_multiplayer:
|
||||
label_name.text = "Team Name 0/8:"
|
||||
else:
|
||||
label_name.text = "Player Name 0/8:"
|
||||
|
||||
|
||||
func _on_item_list_item_activated(index: int) -> void:
|
||||
var temp = $Control/ItemList.get_item_text(index)
|
||||
var nbr = player_name.length()
|
||||
if temp == "Back":
|
||||
player_name[-1] = ""
|
||||
elif temp == "Enter" and player_name.length() > 0:
|
||||
GameController.emit_signal("go_to_menu", player_name)
|
||||
elif nbr < 10:
|
||||
if player_name.length() > 0:
|
||||
player_name[-1] = ""
|
||||
elif temp == "Enter" :
|
||||
if player_name.length() > 0:
|
||||
GameController.emit_signal("go_to_menu", player_name)
|
||||
elif nbr < 8:
|
||||
player_name += temp
|
||||
nbr = player_name.length()
|
||||
label_name.text = "Player Name " + str(nbr) +"/10:\n" + player_name
|
||||
if GameController.is_multiplayer:
|
||||
label_name.text = "Team Name "
|
||||
else:
|
||||
label_name.text = "Player Name "
|
||||
label_name.text += str(nbr) +"/8:\n" + player_name
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@ class_name Ship
|
||||
@export var TIME_INVUL := 1.0
|
||||
@export var animation : AnimationPlayer
|
||||
@export var target : Node2D
|
||||
@export var player_2 := false
|
||||
|
||||
const SPEED = 25.0
|
||||
const JUMP_VELOCITY = -400.0
|
||||
@@ -20,13 +21,12 @@ var is_in = true
|
||||
var delay_inv := 0.0
|
||||
var is_currently_hit := false
|
||||
|
||||
func _input(event):
|
||||
pass
|
||||
|
||||
func _ready() -> void:
|
||||
delay_inv = TIME_INVUL +1
|
||||
GameController.connect("player_hit", start_inv)
|
||||
|
||||
|
||||
func _physics_process(delta: float) -> void:
|
||||
delay += delta
|
||||
if is_inv():
|
||||
@@ -34,29 +34,32 @@ func _physics_process(delta: float) -> void:
|
||||
animation.play("blink")
|
||||
else:
|
||||
animation.play("RESET")
|
||||
|
||||
horizontal = Input.get_axis("ui_up", "ui_down")
|
||||
vertical = Input.get_axis("ui_left", "ui_right")
|
||||
if vertical != 0:
|
||||
velocity.x = move_toward(velocity.x, MAX_SPEED * vertical, SPEED)
|
||||
if ! player_2:
|
||||
horizontal = Input.get_axis("ui_up", "ui_down")
|
||||
vertical = Input.get_axis("ui_left", "ui_right")
|
||||
else:
|
||||
horizontal = Input.get_axis("up_player_2", "down_player_2")
|
||||
vertical = Input.get_axis("left_player_2", "right_player_2")
|
||||
direction = Vector2(vertical, horizontal).normalized()
|
||||
if direction.x != 0:
|
||||
velocity.x = move_toward(velocity.x, MAX_SPEED * direction.x, SPEED)
|
||||
else:
|
||||
velocity.x = move_toward(velocity.x, 0, SPEED)
|
||||
|
||||
if horizontal != 0:
|
||||
velocity.y = move_toward(velocity.y, MAX_SPEED * horizontal, SPEED)
|
||||
if direction.y != 0:
|
||||
velocity.y = move_toward(velocity.y, MAX_SPEED * direction.y, SPEED)
|
||||
else:
|
||||
velocity.y = move_toward(velocity.y, 0, SPEED)
|
||||
|
||||
if horizontal != 0 or vertical != 0:
|
||||
direction = Vector2(vertical, horizontal)
|
||||
rotation = rotate_toward(rotation ,atan2(horizontal, vertical), 0.5)
|
||||
|
||||
rotation = rotate_toward(rotation ,atan2(horizontal, vertical), 0.4)
|
||||
|
||||
if Input.is_action_pressed("ui_accept") and delay >= 0.5:
|
||||
if (( not player_2 and Input.is_action_pressed("ui_accept")) or ( player_2 and Input.is_action_pressed("accept_player_2"))) and delay >= 0.5:
|
||||
shoot()
|
||||
delay = 0
|
||||
if !is_inv() and is_currently_hit:
|
||||
GameController.emit_signal("player_hit")
|
||||
GameController.emit_signal("player_hit", player_2)
|
||||
|
||||
move_and_slide()
|
||||
|
||||
@@ -71,5 +74,6 @@ func shoot()->void:
|
||||
func is_inv() -> bool:
|
||||
return delay_inv <= TIME_INVUL
|
||||
|
||||
func start_inv()->void:
|
||||
delay_inv = 0.0
|
||||
func start_inv(type : bool)->void:
|
||||
if type == player_2 :
|
||||
delay_inv = 0.0
|
||||
|
||||
@@ -18,8 +18,3 @@ func _process(delta: float) -> void:
|
||||
time += delta
|
||||
if time >= 2:
|
||||
self.queue_free()
|
||||
|
||||
|
||||
func _on_body_entered(body: Node) -> void:
|
||||
if body is Shoot:
|
||||
self.queue_free()
|
||||
|
||||
17
script/ui.gd
17
script/ui.gd
@@ -5,7 +5,7 @@ extends CanvasLayer
|
||||
var player_life:= 3
|
||||
var score := 0
|
||||
var time := 0.0
|
||||
|
||||
@export var show_score :PackedScene = load("res://scene/score_particles.tscn")
|
||||
|
||||
func _ready() -> void:
|
||||
GameController.connect("player_hit", update_player)
|
||||
@@ -14,12 +14,21 @@ func _ready() -> void:
|
||||
func _process(delta: float) -> void:
|
||||
time += delta
|
||||
|
||||
func update_score(add : int)->void:
|
||||
score += 2 ** (5-add) * (1 + (time / 100))
|
||||
func update_score(add : int, ast_pos: Vector2)->void:
|
||||
var temp = 2 ** (5-add) * (1 + (time / 100))
|
||||
spawn_score(temp,ast_pos)
|
||||
score += temp
|
||||
label_score.text = str(score)
|
||||
|
||||
func update_player() -> void:
|
||||
func update_player(_type:bool) -> void:
|
||||
player_life -= 1
|
||||
if player_life < 0:
|
||||
GameController.emit_signal("go_to_score_saver", score)
|
||||
box_player1.get_children(false)[player_life].visible = false
|
||||
|
||||
|
||||
func spawn_score(score: int,pos : Vector2)->void:
|
||||
var new = show_score.instantiate()
|
||||
new.global_position = pos
|
||||
new.score = score
|
||||
get_parent().add_child(new)
|
||||
|
||||
33
theme.tres
33
theme.tres
@@ -127,6 +127,10 @@ corner_radius_top_right = 3
|
||||
corner_radius_bottom_right = 3
|
||||
corner_radius_bottom_left = 3
|
||||
corner_detail = 5
|
||||
expand_margin_left = 4.0
|
||||
expand_margin_top = 4.0
|
||||
expand_margin_right = 4.0
|
||||
expand_margin_bottom = 4.0
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_1rmny"]
|
||||
content_margin_left = 4.0
|
||||
@@ -134,11 +138,13 @@ content_margin_top = 4.0
|
||||
content_margin_right = 4.0
|
||||
content_margin_bottom = 4.0
|
||||
bg_color = Color(0, 0, 0, 1)
|
||||
corner_radius_top_left = 3
|
||||
corner_radius_top_right = 3
|
||||
corner_radius_bottom_right = 3
|
||||
corner_radius_bottom_left = 3
|
||||
border_width_left = 4
|
||||
border_width_top = 4
|
||||
border_width_right = 4
|
||||
border_width_bottom = 4
|
||||
border_color = Color(1, 1, 1, 1)
|
||||
corner_detail = 5
|
||||
anti_aliasing = false
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_mihib"]
|
||||
content_margin_left = 4.0
|
||||
@@ -152,10 +158,24 @@ border_width_right = 4
|
||||
border_width_bottom = 4
|
||||
border_color = Color(1, 1, 1, 1)
|
||||
corner_detail = 5
|
||||
expand_margin_left = 8.0
|
||||
expand_margin_top = 8.0
|
||||
expand_margin_right = 8.0
|
||||
expand_margin_bottom = 8.0
|
||||
anti_aliasing = false
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_e1x85"]
|
||||
bg_color = Color(0, 0, 0, 1)
|
||||
border_width_left = 2
|
||||
border_width_top = 2
|
||||
border_width_right = 2
|
||||
border_width_bottom = 2
|
||||
border_color = Color(1, 1, 1, 1)
|
||||
expand_margin_left = 2.0
|
||||
expand_margin_top = 2.0
|
||||
expand_margin_right = 2.0
|
||||
expand_margin_bottom = 2.0
|
||||
anti_aliasing = false
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_wvktn"]
|
||||
content_margin_left = 0.0
|
||||
@@ -196,7 +216,7 @@ ItemList/colors/font_hovered_color = Color(0.95, 0.95, 0.95, 1)
|
||||
ItemList/colors/font_hovered_selected_color = Color(1, 1, 1, 1)
|
||||
ItemList/colors/font_outline_color = Color(0, 0, 0, 1)
|
||||
ItemList/colors/font_selected_color = Color(1, 1, 1, 1)
|
||||
ItemList/colors/guide_color = Color(0.7, 0.7, 0.7, 0.25)
|
||||
ItemList/colors/guide_color = Color(0, 0, 0, 0)
|
||||
ItemList/constants/h_separation = 8
|
||||
ItemList/constants/icon_margin = 0
|
||||
ItemList/constants/line_separation = 0
|
||||
@@ -216,7 +236,7 @@ ItemList/styles/selected_focus = SubResource("StyleBoxFlat_mihib")
|
||||
Label/colors/font_color = Color(1, 1, 1, 1)
|
||||
Label/colors/font_outline_color = Color(0, 0, 0, 1)
|
||||
Label/colors/font_shadow_color = Color(0, 0, 0, 0)
|
||||
Label/constants/line_spacing = 3
|
||||
Label/constants/line_spacing = 6
|
||||
Label/constants/outline_size = 0
|
||||
Label/constants/shadow_offset_x = 1
|
||||
Label/constants/shadow_offset_y = 1
|
||||
@@ -225,3 +245,4 @@ Label/font_sizes/font_size = 32
|
||||
Label/fonts/font = ExtResource("1_e1x85")
|
||||
Label/styles/normal = SubResource("StyleBoxFlat_e1x85")
|
||||
PanelContainer/styles/panel = SubResource("StyleBoxFlat_wvktn")
|
||||
VBoxContainer/constants/separation = 4
|
||||
|
||||
Reference in New Issue
Block a user