From 39a399f1377ac37bff75cc88d33caa09d56b1ae2 Mon Sep 17 00:00:00 2001 From: Victor Turgeon Date: Sun, 15 Jan 2023 11:17:51 -0500 Subject: [PATCH] Ze pew --- .godot/editor/create_recent.Node | 4 +- .godot/editor/editor_layout.cfg | 4 +- .godot/editor/filesystem_cache7 | 71 ++++++++++-------- .godot/editor/filesystem_update4 | 15 +++- .godot/editor/project_metadata.cfg | 6 +- .godot/editor/recent_dirs | 2 + .godot/editor/script_editor_cache.cfg | 40 +++++++--- ...state-4b15d5b2c95b81f0d5516148b6f1d415.cfg | 4 +- .godot/uid_cache.bin | Bin 778 -> 1201 bytes Enemies/basic_enemy.gd | 2 +- PickableItems/basic_item.gd | 12 +++ PickableItems/basic_item.tscn | 19 +++++ PickableItems/pickable_shoes.tscn | 16 ++++ PickableItems/pickable_t_shirt.tscn | 11 +++ Player/player.gd | 13 ++-- Player/player.tscn | 4 +- Projectiles/basic_projectile.gd | 29 +++++-- Projectiles/basic_projectile.tscn | 4 +- Projectiles/sand.tscn | 13 ++++ Sprites/shoes.png | Bin 0 -> 475 bytes Sprites/shoes.png.import | 34 +++++++++ Sprites/t_shirt.png | Bin 0 -> 1372 bytes Sprites/t_shirt.png.import | 34 +++++++++ Weapons/basic_weapon.gd | 6 +- Weapons/hourglass.tscn | 21 ++++++ Weapons/shotgun.tscn | 15 ---- Weapons/t_shirt_cannon.tscn | 19 +++++ test_level001.tscn | 10 ++- 28 files changed, 316 insertions(+), 92 deletions(-) create mode 100644 PickableItems/basic_item.gd create mode 100644 PickableItems/basic_item.tscn create mode 100644 PickableItems/pickable_shoes.tscn create mode 100644 PickableItems/pickable_t_shirt.tscn create mode 100644 Projectiles/sand.tscn create mode 100644 Sprites/shoes.png create mode 100644 Sprites/shoes.png.import create mode 100644 Sprites/t_shirt.png create mode 100644 Sprites/t_shirt.png.import create mode 100644 Weapons/hourglass.tscn delete mode 100644 Weapons/shotgun.tscn create mode 100644 Weapons/t_shirt_cannon.tscn diff --git a/.godot/editor/create_recent.Node b/.godot/editor/create_recent.Node index 40a375f..a145dd0 100644 --- a/.godot/editor/create_recent.Node +++ b/.godot/editor/create_recent.Node @@ -1,10 +1,10 @@ Timer +Sprite2D +CollisionShape2D Area2D StaticBody2D RigidBody2D RayCast2D -CollisionShape2D -Sprite2D AnimatedSprite2D CharacterBody2D CollisionPolygon2D diff --git a/.godot/editor/editor_layout.cfg b/.godot/editor/editor_layout.cfg index 83b190d..f03a916 100644 --- a/.godot/editor/editor_layout.cfg +++ b/.godot/editor/editor_layout.cfg @@ -16,11 +16,11 @@ dock_5="Inspector,Node,History" [EditorNode] -open_scenes=["res://test_level001.tscn", "res://Enemies/basic_enemy.tscn", "res://Player/player.tscn", "res://Weapons/shotgun.tscn"] +open_scenes=["res://Projectiles/sand.tscn"] [ScriptEditor] -open_scripts=["res://Enemies/basic_enemy.gd", "res://Projectiles/basic_projectile.gd", "res://Weapons/basic_weapon.gd", "res://Player/player.gd"] +open_scripts=["res://Enemies/basic_enemy.gd", "res://PickableItems/basic_item.gd", "res://Projectiles/basic_projectile.gd", "res://Weapons/basic_weapon.gd", "res://Player/player.gd"] open_help=["Area2D", "CharacterBody2D", "Node2D", "RandomNumberGenerator", "RayCast2D", "RigidBody2D", "StaticBody2D", "Vector2"] script_split_offset=70 list_split_offset=0 diff --git a/.godot/editor/filesystem_cache7 b/.godot/editor/filesystem_cache7 index bf819a9..3a3c49e 100644 --- a/.godot/editor/filesystem_cache7 +++ b/.godot/editor/filesystem_cache7 @@ -1,33 +1,40 @@ 0b7126e0c6e86d3ec295a72f5aa6e0bd -::res://::1673759153 -README.md::TextFile::-1::1673744149::0::1::::<><>:: -test_level001.tscn::PackedScene::278447013021769396::1673758831::0::1::::<><>::uid://xev8p1td1icx<>uid://d3y4rna66nylu<>uid://c661br4lh30r8 -::res://Enemies/::1673758831 -basic_enemy.gd::GDScript::-1::1673757641::0::1::::<>CharacterBody2D<>:: -basic_enemy.tscn::PackedScene::7014272596353446583::1673758831::0::1::::<><>::res://Enemies/basic_enemy.gd<>uid://ds4uvvrcxoay1 -::res://Levels/::1673744149 -level.tscn::PackedScene::4739050375457527030::1673744149::0::1::::<><>:: -::res://Music/::1673744196 -School_Bass.ogg::AudioStreamOggVorbis::8337090337929631753::1673744149::1673744196::1::::<><>:: -School_BDClave.ogg::AudioStreamOggVorbis::2352609159460477887::1673744149::1673744196::1::::<><>:: -School_Brass.ogg::AudioStreamOggVorbis::8423202159412100063::1673744149::1673744196::1::::<><>:: -School_Flute.ogg::AudioStreamOggVorbis::6100788483817358773::1673744149::1673744196::1::::<><>:: -School_Snare.ogg::AudioStreamOggVorbis::6764331197145035365::1673744149::1673744196::1::::<><>:: -::res://Player/::1673758831 -player.gd::GDScript::-1::1673758741::0::1::::<>CharacterBody2D<>:: -player.tscn::PackedScene::1623935731621421531::1673758831::0::1::::<><>::res://Player/player.gd<>uid://cmtuq84761y0i<>uid://wkeakqjvu3gg -::res://Projectiles/::1673757957 -basic_projectile.gd::GDScript::-1::1673757658::0::1::::<>Area2D<>:: -basic_projectile.tscn::PackedScene::5856608848916302392::1673757957::0::1::::<><>::res://Projectiles/basic_projectile.gd<>uid://gqotbni355f -::res://Sprites/::1673758613 -placeholder_enemy.png::CompressedTexture2D::8483781162333137450::1673744660::1673744680::1::::<><>:: -placeholder_player.png::CompressedTexture2D::1565041755936548690::1673744149::1673744500::1::::<><>:: -placeholder_projectile.png::CompressedTexture2D::13383739614235193::1673744149::1673744515::1::::<><>:: -placeholder_shotgun.png::CompressedTexture2D::1210666365428533629::1673758421::1673758613::1::::<><>:: -placeholder_weapon.png::CompressedTexture2D::7577871081029115281::1673744149::1673744508::1::::<><>:: -::res://TileSets/::1673744149 -Tiles Set GameJam.png::CompressedTexture2D::9175886574582270754::1673744149::1673744149::1::::<><>:: -::res://Weapons/::1673759002 -basic_weapon.gd::GDScript::-1::1673757935::0::1::::<>Node2D<>:: -basic_weapon.tscn::PackedScene::5655575360493827386::1673757957::0::1::::<><>::res://Weapons/basic_weapon.gd<>uid://df71outtqfcu0<>uid://cpo8qy3y0fuui -shotgun.tscn::PackedScene::2587411923144706110::1673759002::0::1::::<><>::uid://cmtuq84761y0i<>uid://ripq64urxouv +::res://::1673794835 +README.md::TextFile::-1::1673712834::0::1::::<><>:: +test_level001.tscn::PackedScene::278447013021769396::1673794835::0::1::::<><>::uid://xev8p1td1icx<>uid://d3y4rna66nylu<>uid://c661br4lh30r8<>uid://bbg5x0apue0ei<>uid://ca1wv2br88fh8 +::res://Enemies/::1673794178 +basic_enemy.gd::GDScript::-1::1673786161::0::1::::<>CharacterBody2D<>:: +basic_enemy.tscn::PackedScene::7014272596353446583::1673794178::0::1::::<><>::res://Enemies/basic_enemy.gd<>uid://ds4uvvrcxoay1 +::res://Levels/::1673726687 +level.tscn::PackedScene::4739050375457527030::1673726687::0::1::::<><>:: +::res://Music/::1673734693 +School_Bass.ogg::AudioStreamOggVorbis::8337090337929631753::1673734497::1673734693::1::::<><>:: +School_BDClave.ogg::AudioStreamOggVorbis::2352609159460477887::1673734497::1673734693::1::::<><>:: +School_Brass.ogg::AudioStreamOggVorbis::8423202159412100063::1673734497::1673734693::1::::<><>:: +School_Flute.ogg::AudioStreamOggVorbis::6100788483817358773::1673734497::1673734693::1::::<><>:: +School_Snare.ogg::AudioStreamOggVorbis::6764331197145035365::1673734497::1673734693::1::::<><>:: +::res://PickableItems/::1673794737 +basic_item.gd::GDScript::-1::1673794339::0::1::::<>Area2D<>:: +basic_item.tscn::PackedScene::5399764951176951635::1673793581::0::1::::<><>::uid://cjrh8t1n0m2e4<>res://PickableItems/basic_item.gd +pickable_t_shirt.tscn::PackedScene::2470859690690496564::1673794737::0::1::::<><>::uid://ci6xls3xseci2<>uid://cmtuq84761y0i +pickable_shoes.tscn::PackedScene::4827889884997683995::1673794730::0::1::::<><>::uid://ci6xls3xseci2<>uid://bc4mkctxjnugk<>uid://dvwb4dx0p0ypw +::res://Player/::1673794835 +player.gd::GDScript::-1::1673794328::0::1::::<>CharacterBody2D<>:: +player.tscn::PackedScene::1623935731621421531::1673794835::0::1::::<><>::res://Player/player.gd<>uid://wkeakqjvu3gg +::res://Projectiles/::1673786161 +basic_projectile.gd::GDScript::-1::1673786161::0::1::::<>Area2D<>:: +basic_projectile.tscn::PackedScene::5856608848916302392::1673786161::0::1::::<><>::res://Projectiles/basic_projectile.gd<>uid://gqotbni355f +::res://Sprites/::1673794397 +placeholder_enemy.png::CompressedTexture2D::8483781162333137450::1673786162::1673786214::1::::<><>:: +placeholder_player.png::CompressedTexture2D::1565041755936548690::1673786162::1673786214::1::::<><>:: +placeholder_projectile.png::CompressedTexture2D::13383739614235193::1673786162::1673786214::1::::<><>:: +placeholder_shotgun.png::CompressedTexture2D::1210666365428533629::1673786162::1673786214::1::::<><>:: +placeholder_weapon.png::CompressedTexture2D::7577871081029115281::1673786162::1673786214::1::::<><>:: +shoes.png::CompressedTexture2D::8678756777340800268::1673794389::1673794397::1::::<><>:: +t_shirt.png::CompressedTexture2D::5440120370828876065::1673791973::1673791980::1::::<><>:: +::res://TileSets/::1673734812 +Tiles Set GameJam.png::CompressedTexture2D::9175886574582270754::1673734812::1673734812::1::::<><>:: +::res://Weapons/::1673794835 +basic_weapon.gd::GDScript::-1::1673786162::0::1::::<>Node2D<>:: +basic_weapon.tscn::PackedScene::5655575360493827386::1673786162::0::1::::<><>::res://Weapons/basic_weapon.gd<>uid://df71outtqfcu0<>uid://cpo8qy3y0fuui +shotgun.tscn::PackedScene::2587411923144706110::1673794853::0::1::::<><>::uid://cmtuq84761y0i<>uid://dvwb4dx0p0ypw diff --git a/.godot/editor/filesystem_update4 b/.godot/editor/filesystem_update4 index d1c5792..6945541 100644 --- a/.godot/editor/filesystem_update4 +++ b/.godot/editor/filesystem_update4 @@ -1,5 +1,16 @@ -res://Weapons/shotgun.tscn +res://PickableItems/basic_item.tscn +res://Player/player.tscn +res://Player/player.gd +res://PickableItems/basic_item.gd res://test_level001.tscn res://Enemies/basic_enemy.tscn -res://Player/player.tscn +res://PickableItems/pickable_t_shirt.tscn +res://PickableItems/pickable_shoes.tscn +res://Weapons/shotgun.tscn +res://Weapons/hourglass.tscn +res://Weapons/t_shirt_cannon.tscn +res://Projectiles/sand.tscn +res://Projectiles/basic_projectile.gd +res://Projectiles/basic_projectile.tscn +res://Enemies/basic_enemy.gd res://Weapons/basic_weapon.gd diff --git a/.godot/editor/project_metadata.cfg b/.godot/editor/project_metadata.cfg index 43ed53e..eba4cec 100644 --- a/.godot/editor/project_metadata.cfg +++ b/.godot/editor/project_metadata.cfg @@ -1,6 +1,6 @@ [editor_metadata] -executable_path="/home/medenos/Downloads/Godot_v4.0-beta12_mono_linux_x86_64/Godot_v4.0-beta12_mono_linux.x86_64" +executable_path="C:/Godot_v4.0-beta12_mono_win64/Godot_v4.0-beta12_mono_win64/Godot_v4.0-beta12_mono_win64.exe" tile_source_sort=0 use_advanced_connections=false @@ -11,8 +11,8 @@ run_reload_scripts=true [recent_files] -scenes=["res://Weapons/shotgun.tscn", "res://Player/player.tscn", "res://Enemies/basic_enemy.tscn", "res://test_level001.tscn", "res://Weapons/basic_weapon.tscn", "res://Projectiles/basic_projectile.tscn", "res://Enemies/basic_enemie.tscn", "res://player.tscn"] -scripts=["Vector2", "StaticBody2D", "RigidBody2D", "RayCast2D", "RandomNumberGenerator", "Node2D", "CharacterBody2D", "Area2D", "res://Weapons/shotgun.gd", "res://Projectiles/basic_projectile.gd"] +scenes=["res://Projectiles/sand.tscn", "res://Weapons/hourglass.tscn", "res://Projectiles/basic_projectile.tscn", "res://PickableItems/pickable_t_shirt.tscn", "res://Weapons/t_shirt_cannon.tscn", "res://Weapons/basic_weapon.tscn", "res://Weapons/shotgun.tscn", "res://PickableItems/pickable_shoes.tscn", "res://PickableItems/basic_item.tscn", "res://Player/player.tscn"] +scripts=["res://PickableItems/basic_item.gd", "Vector2", "StaticBody2D", "RigidBody2D", "RayCast2D", "RandomNumberGenerator", "Node2D", "CharacterBody2D", "Area2D", "res://Weapons/shotgun.gd"] [script_setup] diff --git a/.godot/editor/recent_dirs b/.godot/editor/recent_dirs index 2ae928b..5071c65 100644 --- a/.godot/editor/recent_dirs +++ b/.godot/editor/recent_dirs @@ -1,4 +1,6 @@ +res://Projectiles res://Weapons +res://PickableItems res://Enemies res:// res://Levels diff --git a/.godot/editor/script_editor_cache.cfg b/.godot/editor/script_editor_cache.cfg index df570f7..73d45c2 100644 --- a/.godot/editor/script_editor_cache.cfg +++ b/.godot/editor/script_editor_cache.cfg @@ -3,12 +3,16 @@ state={ "bookmarks": PackedInt32Array(), "breakpoints": PackedInt32Array(), -"column": 36, +"column": 66, "folded_lines": [], "h_scroll_position": 0, -"row": 40, -"scroll_position": 3.0, -"selection": false, +"row": 69, +"scroll_position": 55.0, +"selection": true, +"selection_from_column": 2, +"selection_from_line": 69, +"selection_to_column": 66, +"selection_to_line": 69, "syntax_highlighter": "GDScript" } @@ -17,10 +21,10 @@ state={ state={ "bookmarks": PackedInt32Array(), "breakpoints": PackedInt32Array(), -"column": 24, +"column": 30, "folded_lines": [], "h_scroll_position": 0, -"row": 7, +"row": 4, "scroll_position": 0.0, "selection": false, "syntax_highlighter": "GDScript" @@ -31,11 +35,11 @@ state={ state={ "bookmarks": PackedInt32Array(), "breakpoints": PackedInt32Array(), -"column": 130, +"column": 123, "folded_lines": [], "h_scroll_position": 0, -"row": 27, -"scroll_position": 0.0, +"row": 30, +"scroll_position": 10.0, "selection": false, "syntax_highlighter": "GDScript" } @@ -45,10 +49,24 @@ state={ state={ "bookmarks": PackedInt32Array(), "breakpoints": PackedInt32Array(), -"column": 23, +"column": 24, "folded_lines": [], "h_scroll_position": 0, -"row": 2, +"row": 3, +"scroll_position": 0.0, +"selection": false, +"syntax_highlighter": "GDScript" +} + +[res://PickableItems/basic_item.gd] + +state={ +"bookmarks": PackedInt32Array(), +"breakpoints": PackedInt32Array(), +"column": 0, +"folded_lines": [], +"h_scroll_position": 0, +"row": 12, "scroll_position": 0.0, "selection": false, "syntax_highlighter": "GDScript" diff --git a/.godot/editor/test_level001.tscn-editstate-4b15d5b2c95b81f0d5516148b6f1d415.cfg b/.godot/editor/test_level001.tscn-editstate-4b15d5b2c95b81f0d5516148b6f1d415.cfg index a8d5f26..5f5b5ac 100644 --- a/.godot/editor/test_level001.tscn-editstate-4b15d5b2c95b81f0d5516148b6f1d415.cfg +++ b/.godot/editor/test_level001.tscn-editstate-4b15d5b2c95b81f0d5516148b6f1d415.cfg @@ -8,7 +8,7 @@ Anim={ "grid_snap_active": false, "grid_step": Vector2(8, 8), "grid_visibility": 1, -"ofs": Vector2(-835.537, -590.651), +"ofs": Vector2(-21.4942, 2.96472), "primary_grid_steps": 8, "show_edit_locks": true, "show_guides": true, @@ -32,7 +32,7 @@ Anim={ "snap_rotation_step": 0.261799, "snap_scale": false, "snap_scale_step": 0.1, -"zoom": 0.629961 +"zoom": 2.11893 } 3D={ "fov": 70.01, diff --git a/.godot/uid_cache.bin b/.godot/uid_cache.bin index 89b89fb241f81f867b066f488e4e7589c7a72e10..80af9915a85ce43f5f154b0fbb1031e8a4dc2d40 100644 GIT binary patch delta 438 zcmeBT+sMf%vym}{Nl{U9e%*3|dT&Vv28N>4Vk>?9;DVyelGI}TlKA3`%%YOXiA*c& zgSR(o&b|2FOBt>zATv2TF)1h2vm`aQSU)MTI5RmOs4Z8oq&PXx#G^p-jH8#5CJyBV zP|fjBJHVQFdNZf`DHm4AVrr@fTN0d+pIWR}ke3cqDGpZ&b2AZ2ieaWmbN|hBm0@sJ zhns@xC%7YvGwMMWgFI%}v8*gV^o6nvTu*pvVnKdhv3^E=X;FGkVlhOW+A7_p2GU)= wiWuskK8{aL%*)Hq0~_ibd$zMWNm^AJt~j75KPxr4Br^vX4aJFhDXd_10N);#5dZ)H delta 14 VcmdnU*~P{vw2?7|X>u3SQUD$s1Udi! diff --git a/Enemies/basic_enemy.gd b/Enemies/basic_enemy.gd index 9d3082b..27e1b39 100644 --- a/Enemies/basic_enemy.gd +++ b/Enemies/basic_enemy.gd @@ -3,7 +3,7 @@ extends CharacterBody2D @export var MAX_SPEED = 300.0; @export var ACCELERATION = 1000.0; @export var FRICTION = 1500.0; -@export var HP = 20; +@export var HP = 100; @export var DAMAGE = 34; @export var COOLDOWN = 2; diff --git a/PickableItems/basic_item.gd b/PickableItems/basic_item.gd new file mode 100644 index 0000000..5c3c2b7 --- /dev/null +++ b/PickableItems/basic_item.gd @@ -0,0 +1,12 @@ +extends Area2D + +@export var Type : String; +@export var Item : PackedScene; + +func _on_body_entered(body): + if body.name == "Player": + pickup_routine(body); + +func pickup_routine(player): + player.pickup(self); + queue_free(); diff --git a/PickableItems/basic_item.tscn b/PickableItems/basic_item.tscn new file mode 100644 index 0000000..677f8b9 --- /dev/null +++ b/PickableItems/basic_item.tscn @@ -0,0 +1,19 @@ +[gd_scene load_steps=4 format=3 uid="uid://ci6xls3xseci2"] + +[ext_resource type="Texture2D" uid="uid://cjrh8t1n0m2e4" path="res://Sprites/t_shirt.png" id="1_mqcsa"] +[ext_resource type="Script" path="res://PickableItems/basic_item.gd" id="1_txlye"] + +[sub_resource type="RectangleShape2D" id="RectangleShape2D_0nj5p"] +size = Vector2(29, 50) + +[node name="basic_item" type="Area2D"] +script = ExtResource("1_txlye") + +[node name="CollisionShape2D" type="CollisionShape2D" parent="."] +position = Vector2(0.5, 1) +shape = SubResource("RectangleShape2D_0nj5p") + +[node name="Sprite2D" type="Sprite2D" parent="."] +texture = ExtResource("1_mqcsa") + +[connection signal="body_entered" from="." to="." method="_on_body_entered"] diff --git a/PickableItems/pickable_shoes.tscn b/PickableItems/pickable_shoes.tscn new file mode 100644 index 0000000..9ae99ab --- /dev/null +++ b/PickableItems/pickable_shoes.tscn @@ -0,0 +1,16 @@ +[gd_scene load_steps=4 format=3] + +[ext_resource type="PackedScene" uid="uid://ci6xls3xseci2" path="res://PickableItems/basic_item.tscn" id="1_c3jw1"] +[ext_resource type="PackedScene" uid="uid://bc4mkctxjnugk" path="res://Weapons/hourglass.tscn" id="2_f6mwn"] +[ext_resource type="Texture2D" uid="uid://dvwb4dx0p0ypw" path="res://Sprites/shoes.png" id="3_bsb8q"] + +[node name="shoes" instance=ExtResource("1_c3jw1")] +Type = "weapon" +Item = ExtResource("2_f6mwn") + +[node name="CollisionShape2D" parent="." index="0"] +position = Vector2(-0.5, -1) + +[node name="Sprite2D" parent="." index="1"] +position = Vector2(18, 22) +texture = ExtResource("3_bsb8q") diff --git a/PickableItems/pickable_t_shirt.tscn b/PickableItems/pickable_t_shirt.tscn new file mode 100644 index 0000000..a2ca5b6 --- /dev/null +++ b/PickableItems/pickable_t_shirt.tscn @@ -0,0 +1,11 @@ +[gd_scene load_steps=3 format=3 uid="uid://bbg5x0apue0ei"] + +[ext_resource type="PackedScene" uid="uid://ci6xls3xseci2" path="res://PickableItems/basic_item.tscn" id="1_a7gul"] +[ext_resource type="PackedScene" uid="uid://clusfc1udsrt3" path="res://Weapons/t_shirt_cannon.tscn" id="2_8v7ss"] + +[node name="pickable_t_shirt" instance=ExtResource("1_a7gul")] +Type = "weapon" +Item = ExtResource("2_8v7ss") + +[node name="CollisionShape2D" parent="." index="0"] +position = Vector2(1, 0.5) diff --git a/Player/player.gd b/Player/player.gd index ad2ba63..036b8af 100644 --- a/Player/player.gd +++ b/Player/player.gd @@ -4,7 +4,6 @@ extends CharacterBody2D @export var ACCELERATION = 2000.0; @export var FRICTION = 3000.0; @export var HP = 100; -@export var STARTING_WEAPON : PackedScene; @onready var raycast = $RayCast2D; var current_weapon = null; @@ -12,10 +11,6 @@ var weapons = [null,null,null]; func _ready(): call_deferred("call_set_player"); - weapons[0] = STARTING_WEAPON.instantiate(); - weapons[1] = load("res://Weapons/shotgun.tscn").instantiate(); - current_weapon = weapons[0]; - raycast.add_child(current_weapon); func _physics_process(delta): var input_vector = get_input_vector(); @@ -48,6 +43,14 @@ func take_damage(damage): if HP <= 0: kill(); +func pickup(item): + if item.Type == "weapon": + for n in 3: + if !weapons[n]: + weapons[n] = item.Item.instantiate(); + change_weapon(n); + return; + func kill(): get_tree().reload_current_scene(); diff --git a/Player/player.tscn b/Player/player.tscn index 213a5fd..5ce5edf 100644 --- a/Player/player.tscn +++ b/Player/player.tscn @@ -1,7 +1,6 @@ -[gd_scene load_steps=6 format=3 uid="uid://xev8p1td1icx"] +[gd_scene load_steps=5 format=3 uid="uid://xev8p1td1icx"] [ext_resource type="Script" path="res://Player/player.gd" id="1_mbyc2"] -[ext_resource type="PackedScene" uid="uid://cmtuq84761y0i" path="res://Weapons/basic_weapon.tscn" id="2_bo475"] [ext_resource type="Texture2D" uid="uid://wkeakqjvu3gg" path="res://Sprites/placeholder_player.png" id="2_bqbmq"] [sub_resource type="SpriteFrames" id="SpriteFrames_mqbrd"] @@ -20,7 +19,6 @@ size = Vector2(40, 64) [node name="Player" type="CharacterBody2D"] script = ExtResource("1_mbyc2") -STARTING_WEAPON = ExtResource("2_bo475") [node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."] frames = SubResource("SpriteFrames_mqbrd") diff --git a/Projectiles/basic_projectile.gd b/Projectiles/basic_projectile.gd index e376262..cd5d6f4 100644 --- a/Projectiles/basic_projectile.gd +++ b/Projectiles/basic_projectile.gd @@ -2,29 +2,42 @@ extends Area2D @export var DAMAGE = 10; @export var SPEED = 700; -@export var LIFETIME = 1; - -@onready var life_timer = $LifeTimer; +@export var LIFETIME = 1.0; +@export var HANG_TIME = 0.0; +@export var FRICTION = 0.0; +var is_hanging = false; var velocity = Vector2.ZERO; +var time = 0.0; func _process(delta): + + if is_hanging : + velocity = velocity * FRICTION; if velocity != Vector2.ZERO: transform.origin += velocity * delta; + + time += delta; + + if time >= LIFETIME: + end_of_life(); + if time >= LIFETIME + HANG_TIME: + explode(); func launch(direction, based_velocity): - life_timer.start(LIFETIME); velocity = based_velocity + direction * SPEED; -func _on_life_timer_timeout(): - queue_free(); - func _on_body_entered(body): if body.name != "Player": if body.is_in_group("enemies"): body.take_damage(DAMAGE); explode(); +func end_of_life(): + is_hanging = true; + func explode(): - #animation and stuff queue_free(); + + + diff --git a/Projectiles/basic_projectile.tscn b/Projectiles/basic_projectile.tscn index 2802511..4c06d0f 100644 --- a/Projectiles/basic_projectile.tscn +++ b/Projectiles/basic_projectile.tscn @@ -4,6 +4,7 @@ [ext_resource type="Texture2D" uid="uid://gqotbni355f" path="res://Sprites/placeholder_projectile.png" id="1_o7jy1"] [sub_resource type="RectangleShape2D" id="RectangleShape2D_pp7ve"] +size = Vector2(4, 4) [node name="basic_projectile" type="Area2D"] script = ExtResource("1_l2kyf") @@ -15,7 +16,4 @@ texture = ExtResource("1_o7jy1") [node name="CollisionShape2D" type="CollisionShape2D" parent="."] shape = SubResource("RectangleShape2D_pp7ve") -[node name="LifeTimer" type="Timer" parent="."] - [connection signal="body_entered" from="." to="." method="_on_body_entered"] -[connection signal="timeout" from="LifeTimer" to="." method="_on_life_timer_timeout"] diff --git a/Projectiles/sand.tscn b/Projectiles/sand.tscn new file mode 100644 index 0000000..00cefee --- /dev/null +++ b/Projectiles/sand.tscn @@ -0,0 +1,13 @@ +[gd_scene load_steps=2 format=3 uid="uid://bedh0enwukdbf"] + +[ext_resource type="PackedScene" uid="uid://cpo8qy3y0fuui" path="res://Projectiles/basic_projectile.tscn" id="1_mqpki"] + +[node name="basic_projectile" instance=ExtResource("1_mqpki")] +DAMAGE = 1 +SPEED = 1000 +LIFETIME = 0.1 +HANG_TIME = 0.3 +FRICTION = 0.92 + +[node name="Sprite2D" parent="." index="0"] +scale = Vector2(2.43502, 2.43502) diff --git a/Sprites/shoes.png b/Sprites/shoes.png new file mode 100644 index 0000000000000000000000000000000000000000..99f8f9bccc43ddb31febf1afeb68ff64d0de3ec9 GIT binary patch literal 475 zcmeAS@N?(olHy`uVBq!ia0vp^4j|0I1|(Ny7TyC=jKx9jP7LeL$-D%zt36#DLn`9l zPP@q4=p!OZ!*k=)tZ@Iv$Uv*{gS2}Pw9Ez^DpLh4^*B^!pe&4ZlPj=Mu zUBlk4oqu*`ovO!EpXb?4+<{X4tGATeChXb#}=84W9&!87pB%Gh~4(qk^b^v z!mBt>0_g{7Y>N8)P&U0rX zL&JiM(!SUj>lMJ`6H62W0;ON@s z!**et7>^pWL%^0)qlRr;6AUC7nilC!X56xtwfQ82fJp94o&~wO5Px({7FPXRCr$PTTMt*Q4~HdB7~wTjIt=HL@W%k*#wbDn;i6_Clh2Ws7GsgxU7s{uJOe!K-5qW!O?1kJP zxhOq-H$9_fXC4GHkYmvQ>d-@ZGI@jJoZ9SkvVw)mb1*ua&C2T9mQ0Oy7m*N%0TBWC z!O=O@ef`UV`YaIP%x-5B5j=pSooL%9Cp$aU_qFxka(B2R6bU+bodDM)xFjI2gU_@a zQ{HcDZI;%SoicR2Ef4_=5qe%%3svBf1Xl!j;9(r4uN!~%bVgo29+AbxMakuI>XI!t z*npcM<1!pv5Riw_G^*v$sj?wXHL%0Pc)ub8gh4$}OpwNVA;FHn^-E!+%RtA`+I5c zzU(U0OXev@06Ip=1e)}}>7{DY3LpW! z*Tzbe27AJ)ATj}yk5*NU&*EivWn7`=F*EVm;BNPtQ9 zwh{oK^uC^$!Voa`bg)Dm-B+e63PvY@k3?3NNr!;)J{t+Zvl$DWpd~TXf(mYW`kb0- zYin73HaEA+z`$$u-H!+x;ZYxjQF4Iys)~ysB)*^o0Q}0zZI48P*WFGc%8_6aK-FRH z?W_ZEGp`zCapD&OCV1WZHr;o1J@?)S>DSE=i1WHEiULeq6$wEIK+K!6_Y3$+1ZZO; z}di7d8yi zssLXVPyt~GSXkIpk43ZMt4acp11iNkW1jtLiU5GKkzmRn-~k-X=6(D>)e7)i44DMj zVxQovmH=~|Zi4h9Aqe=?E1(hq3?TTsfWi(?s&fDi zMs5B%7%0DmRR9wq&J?8fF=!*89MHNZfcuE%POmN<8$rkeHKBl-B|twPNN?IaNdkWT z{470v!`7T(j^pM>sud80fFm8}OLmma(;xu9vHn3;R(~k6Qkw)#0!$!uHHsNFTOKga z8Zh=T1{*PG*o=u=3?;G{($5LWmo1OAhvHGXXU`r9zAh+ z*RXiE*D&Z`9y^>LpC$5%(4FamgQ%Tv`P(V`5R?ED90dUNBZmcB3f&c&j4rN$LW=%~1 eDgXcg2mk;800000(o>TF0000