This commit is contained in:
Victor Turgeon
2023-01-15 11:17:51 -05:00
parent 96581c5f60
commit 39a399f137
28 changed files with 316 additions and 92 deletions

View File

@@ -25,8 +25,10 @@ func fire(wielder_velocity):
get_node("/root").add_child(current_projectile);
current_projectile.transform = raycast.get_global_transform() ;
current_projectile.transform.origin += (get_global_mouse_position() - global_position).normalized() * (rng.randf() * RANGE_MOD);
current_projectile.launch((get_global_mouse_position() - global_position).rotated(rng.randf_range(SPREAD,-SPREAD)).normalized(), wielder_velocity);
var this_range_mod = rng.randf() * RANGE_MOD;
var this_spread_mod = rng.randf_range(SPREAD,-SPREAD);
current_projectile.transform.origin += (get_global_mouse_position() - global_position).normalized() * (this_range_mod);
current_projectile.launch((get_global_mouse_position() - global_position).rotated(this_spread_mod - this_range_mod / 700).normalized(), wielder_velocity);
func _on_cooldown_timer_timeout():

21
Weapons/hourglass.tscn Normal file
View File

@@ -0,0 +1,21 @@
[gd_scene load_steps=4 format=3 uid="uid://bc4mkctxjnugk"]
[ext_resource type="PackedScene" uid="uid://cmtuq84761y0i" path="res://Weapons/basic_weapon.tscn" id="1_yfysf"]
[ext_resource type="Texture2D" uid="uid://dvwb4dx0p0ypw" path="res://Sprites/shoes.png" id="2_oyiyx"]
[ext_resource type="PackedScene" uid="uid://bedh0enwukdbf" path="res://Projectiles/sand.tscn" id="2_qhdqv"]
[node name="hourglass" instance=ExtResource("1_yfysf")]
position = Vector2(65, -1)
PROJECTILE = ExtResource("2_qhdqv")
PROJECTILE_AMOUNT = 200
COOLDOWN = 1.0
SPREAD = 0.5
RANGE_MOD = 100
[node name="Sprite2D" parent="." index="0"]
position = Vector2(32, 38)
scale = Vector2(1.71875, 1.71875)
texture = ExtResource("2_oyiyx")
[node name="RayCast2D" parent="." index="1"]
position = Vector2(-14, 0)

View File

@@ -1,15 +0,0 @@
[gd_scene load_steps=3 format=3 uid="uid://bc4mkctxjnugk"]
[ext_resource type="PackedScene" uid="uid://cmtuq84761y0i" path="res://Weapons/basic_weapon.tscn" id="1_0nefe"]
[ext_resource type="Texture2D" uid="uid://ripq64urxouv" path="res://Sprites/placeholder_shotgun.png" id="2_r5age"]
[node name="shotgun" instance=ExtResource("1_0nefe")]
PROJECTILE_AMOUNT = 4
COOLDOWN = 1.0
SPREAD = 0.3
RANGE_MOD = 40
[node name="Sprite2D" parent="." index="0"]
position = Vector2(18, 3)
scale = Vector2(1.71875, 1.71875)
texture = ExtResource("2_r5age")

View File

@@ -0,0 +1,19 @@
[gd_scene load_steps=3 format=3 uid="uid://clusfc1udsrt3"]
[ext_resource type="PackedScene" uid="uid://cmtuq84761y0i" path="res://Weapons/basic_weapon.tscn" id="1_fyfpr"]
[ext_resource type="Texture2D" uid="uid://cjrh8t1n0m2e4" path="res://Sprites/t_shirt.png" id="2_xni8e"]
[node name="t_shirt_cannon" instance=ExtResource("1_fyfpr")]
position = Vector2(65, 0)
COOLDOWN = 0.8
SPREAD = 0.1
[node name="Sprite2D" parent="." index="0"]
position = Vector2(15, 2.38419e-07)
rotation = 1.64532
scale = Vector2(0.929632, 0.929632)
texture = ExtResource("2_xni8e")
[node name="RayCast2D" parent="." index="1"]
position = Vector2(2, 0)
target_position = Vector2(29, 0)