ZE PEWPENING

This commit is contained in:
Victor Turgeon
2023-01-15 12:27:19 -05:00
parent 2a2eb8ad1f
commit ea11e29ce3
25 changed files with 441 additions and 28 deletions

View File

@@ -5,11 +5,22 @@ extends Area2D
@export var LIFETIME = 1.0;
@export var HANG_TIME = 0.0;
@export var FRICTION = 0.0;
@export var SIZE_MOD = 0.0;
@onready var sprite = $Sprite2D;
var rng = RandomNumberGenerator.new();
var is_hanging = false;
var velocity = Vector2.ZERO;
var time = 0.0;
func _ready():
var size_mod = rng.randf() * SIZE_MOD;
sprite.scale.x -= size_mod;
sprite.scale.y -= size_mod;
func _process(delta):
if is_hanging :
@@ -37,7 +48,8 @@ func end_of_life():
is_hanging = true;
func explode():
velocity = Vector2.ZERO;
sprite.play("explosion");
func _on_sprite_2d_animation_finished():
queue_free();

View File

@@ -1,7 +1,64 @@
[gd_scene load_steps=4 format=3 uid="uid://cpo8qy3y0fuui"]
[gd_scene load_steps=12 format=3 uid="uid://cpo8qy3y0fuui"]
[ext_resource type="Script" path="res://Projectiles/basic_projectile.gd" id="1_l2kyf"]
[ext_resource type="Texture2D" uid="uid://gqotbni355f" path="res://Sprites/placeholder_projectile.png" id="1_o7jy1"]
[ext_resource type="Texture2D" uid="uid://2xd84hbj47vd" path="res://Sprites/sand_sprite.png" id="2_1c2lh"]
[sub_resource type="AtlasTexture" id="AtlasTexture_oqhi1"]
atlas = ExtResource("2_1c2lh")
region = Rect2(0, 0, 64, 64)
[sub_resource type="AtlasTexture" id="AtlasTexture_hwcsx"]
atlas = ExtResource("2_1c2lh")
region = Rect2(64, 0, 64, 64)
[sub_resource type="AtlasTexture" id="AtlasTexture_2kbmk"]
atlas = ExtResource("2_1c2lh")
region = Rect2(128, 0, 64, 64)
[sub_resource type="AtlasTexture" id="AtlasTexture_p1d4t"]
atlas = ExtResource("2_1c2lh")
region = Rect2(192, 0, 64, 64)
[sub_resource type="AtlasTexture" id="AtlasTexture_os7n2"]
atlas = ExtResource("2_1c2lh")
region = Rect2(256, 0, 64, 64)
[sub_resource type="AtlasTexture" id="AtlasTexture_ppc06"]
atlas = ExtResource("2_1c2lh")
region = Rect2(320, 0, 64, 64)
[sub_resource type="AtlasTexture" id="AtlasTexture_7gy0c"]
atlas = ExtResource("2_1c2lh")
region = Rect2(384, 0, 64, 64)
[sub_resource type="SpriteFrames" id="SpriteFrames_5b7u4"]
animations = [{
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_oqhi1")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_hwcsx")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_2kbmk")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_p1d4t")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_os7n2")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_ppc06")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_7gy0c")
}],
"loop": true,
"name": &"explosion",
"speed": 60.0
}]
[sub_resource type="RectangleShape2D" id="RectangleShape2D_pp7ve"]
size = Vector2(4, 4)
@@ -9,11 +66,14 @@ size = Vector2(4, 4)
[node name="basic_projectile" type="Area2D"]
script = ExtResource("1_l2kyf")
[node name="Sprite2D" type="Sprite2D" parent="."]
scale = Vector2(10, 10)
texture = ExtResource("1_o7jy1")
[node name="Sprite2D" type="AnimatedSprite2D" parent="."]
position = Vector2(12, 11)
scale = Vector2(0.531558, 0.531558)
frames = SubResource("SpriteFrames_5b7u4")
animation = &"explosion"
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
shape = SubResource("RectangleShape2D_pp7ve")
[connection signal="body_entered" from="." to="." method="_on_body_entered"]
[connection signal="animation_finished" from="Sprite2D" to="." method="_on_sprite_2d_animation_finished"]

View File

@@ -1,13 +1,75 @@
[gd_scene load_steps=2 format=3 uid="uid://bedh0enwukdbf"]
[gd_scene load_steps=11 format=3 uid="uid://bedh0enwukdbf"]
[ext_resource type="PackedScene" uid="uid://cpo8qy3y0fuui" path="res://Projectiles/basic_projectile.tscn" id="1_mqpki"]
[ext_resource type="Texture2D" uid="uid://2xd84hbj47vd" path="res://Sprites/sand_sprite.png" id="2_gbmp0"]
[sub_resource type="AtlasTexture" id="AtlasTexture_hmv27"]
atlas = ExtResource("2_gbmp0")
region = Rect2(0, 0, 64, 64)
[sub_resource type="AtlasTexture" id="AtlasTexture_3crfb"]
atlas = ExtResource("2_gbmp0")
region = Rect2(64, 0, 64, 64)
[sub_resource type="AtlasTexture" id="AtlasTexture_jn4yo"]
atlas = ExtResource("2_gbmp0")
region = Rect2(128, 0, 64, 64)
[sub_resource type="AtlasTexture" id="AtlasTexture_besyq"]
atlas = ExtResource("2_gbmp0")
region = Rect2(192, 0, 64, 64)
[sub_resource type="AtlasTexture" id="AtlasTexture_gefy0"]
atlas = ExtResource("2_gbmp0")
region = Rect2(256, 0, 64, 64)
[sub_resource type="AtlasTexture" id="AtlasTexture_x03j6"]
atlas = ExtResource("2_gbmp0")
region = Rect2(320, 0, 64, 64)
[sub_resource type="AtlasTexture" id="AtlasTexture_qh7me"]
atlas = ExtResource("2_gbmp0")
region = Rect2(384, 0, 64, 64)
[sub_resource type="SpriteFrames" id="SpriteFrames_frbfh"]
animations = [{
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_hmv27")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_3crfb")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_jn4yo")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_besyq")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_gefy0")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_x03j6")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_qh7me")
}],
"loop": true,
"name": &"explosion",
"speed": 24.0
}]
[node name="basic_projectile" instance=ExtResource("1_mqpki")]
DAMAGE = 1
DAMAGE = 2
SPEED = 1000
LIFETIME = 0.1
HANG_TIME = 0.3
FRICTION = 0.92
SIZE_MOD = 0.15
[node name="Sprite2D" parent="." index="0"]
scale = Vector2(2.43502, 2.43502)
position = Vector2(-14, -13)
rotation = -3.14159
scale = Vector2(0.612389, 0.612389)
frames = SubResource("SpriteFrames_frbfh")

View File

@@ -0,0 +1,38 @@
[gd_scene load_steps=7 format=3 uid="uid://chf2kww8i3xsd"]
[ext_resource type="PackedScene" uid="uid://cpo8qy3y0fuui" path="res://Projectiles/basic_projectile.tscn" id="1_g01wn"]
[ext_resource type="Texture2D" uid="uid://cdrdrffc2b8al" path="res://Sprites/bullet_Shirt_1.png" id="2_quwts"]
[ext_resource type="Texture2D" uid="uid://ded2ewso7kejt" path="res://Sprites/bullet_Shirt_2.png" id="3_wboqr"]
[ext_resource type="Texture2D" uid="uid://c378cpgsik5a1" path="res://Sprites/bullet_Shirt_3.png" id="4_rm1tq"]
[ext_resource type="Texture2D" uid="uid://bnbsl6mg0b8oc" path="res://Sprites/smolshirt.png" id="5_3gdki"]
[sub_resource type="SpriteFrames" id="SpriteFrames_se0yf"]
animations = [{
"frames": [{
"duration": 1.0,
"texture": ExtResource("2_quwts")
}, {
"duration": 1.0,
"texture": ExtResource("4_rm1tq")
}, {
"duration": 1.0,
"texture": ExtResource("3_wboqr")
}, {
"duration": 2.0,
"texture": ExtResource("5_3gdki")
}],
"loop": true,
"name": &"explosion",
"speed": 5.0
}]
[node name="basic_projectile" instance=ExtResource("1_g01wn")]
DAMAGE = 34
[node name="Sprite2D" parent="." index="0"]
position = Vector2(47, 51)
scale = Vector2(2, 2)
frames = SubResource("SpriteFrames_se0yf")
[node name="CollisionShape2D" parent="." index="1"]
position = Vector2(1, 0)