From 9c2ea4245017ab7f0d2c0abbf2d7260faed471d3 Mon Sep 17 00:00:00 2001 From: Cookie-CHR Date: Sun, 3 Apr 2022 11:28:33 +0200 Subject: [PATCH] =?UTF-8?q?=E2=9C=8F=EF=B8=8F=20First=20versions=20of=20ar?= =?UTF-8?q?row=20and=20branch?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit also attached to relative sprite --- src/entities/Bullet.tscn | 2 +- src/entities/Pickup.gd | 2 +- src/entities/Pickup.tscn | 7 ++-- .../behaviours/SpriteRandomRotation.gd | 11 ++++++ src/mechanics/Arrow.png | 3 ++ src/mechanics/Arrow.png.import | 34 +++++++++++++++++++ src/mechanics/Branch1.png | 3 ++ src/mechanics/Branch1.png.import | 34 +++++++++++++++++++ 8 files changed, 91 insertions(+), 5 deletions(-) create mode 100644 src/entities/behaviours/SpriteRandomRotation.gd create mode 100644 src/mechanics/Arrow.png create mode 100644 src/mechanics/Arrow.png.import create mode 100644 src/mechanics/Branch1.png create mode 100644 src/mechanics/Branch1.png.import diff --git a/src/entities/Bullet.tscn b/src/entities/Bullet.tscn index 44294c0..9de1d33 100644 --- a/src/entities/Bullet.tscn +++ b/src/entities/Bullet.tscn @@ -1,6 +1,6 @@ [gd_scene load_steps=6 format=2] -[ext_resource path="res://src/mechanics/White.png" type="Texture" id=1] +[ext_resource path="res://src/mechanics/Arrow.png" type="Texture" id=1] [ext_resource path="res://src/entities/behaviours/BulletMovement.gd" type="Script" id=2] [ext_resource path="res://src/entities/behaviours/Ownership.tscn" type="PackedScene" id=3] [ext_resource path="res://src/entities/Bullet.gd" type="Script" id=4] diff --git a/src/entities/Pickup.gd b/src/entities/Pickup.gd index 30cf6d8..c65a287 100644 --- a/src/entities/Pickup.gd +++ b/src/entities/Pickup.gd @@ -1,7 +1,7 @@ extends Area2D -export var sprite: Texture = preload("res://src/mechanics/White.png") setget set_sprite, get_sprite +export var sprite: Texture = preload("res://src/mechanics/Branch1.png") setget set_sprite, get_sprite export var duration_seconds: float = 1.0 setget set_duration, get_duration export var despawn_seconds: float = INF setget set_despawn, get_despawn diff --git a/src/entities/Pickup.tscn b/src/entities/Pickup.tscn index 8711ee3..48208c8 100644 --- a/src/entities/Pickup.tscn +++ b/src/entities/Pickup.tscn @@ -1,7 +1,8 @@ -[gd_scene load_steps=4 format=2] +[gd_scene load_steps=5 format=2] -[ext_resource path="res://src/mechanics/White.png" type="Texture" id=1] +[ext_resource path="res://src/mechanics/Branch1.png" type="Texture" id=1] [ext_resource path="res://src/entities/Pickup.gd" type="Script" id=2] +[ext_resource path="res://src/entities/behaviours/SpriteRandomRotation.gd" type="Script" id=3] [sub_resource type="RectangleShape2D" id=1] extents = Vector2( 16, 16 ) @@ -15,13 +16,13 @@ shape = SubResource( 1 ) [node name="Sprite" type="Sprite" parent="Shape"] texture = ExtResource( 1 ) +script = ExtResource( 3 ) [node name="Duration" type="Timer" parent="."] one_shot = true [node name="Despawn" type="Timer" parent="."] one_shot = true - [connection signal="body_entered" from="." to="." method="_on_body_entered"] [connection signal="timeout" from="Duration" to="." method="_on_Duration_timeout"] [connection signal="timeout" from="Despawn" to="." method="_on_Despawn_timeout"] diff --git a/src/entities/behaviours/SpriteRandomRotation.gd b/src/entities/behaviours/SpriteRandomRotation.gd new file mode 100644 index 0000000..af570cf --- /dev/null +++ b/src/entities/behaviours/SpriteRandomRotation.gd @@ -0,0 +1,11 @@ +extends Sprite + +var rng : RandomNumberGenerator = RandomNumberGenerator.new() + +func _ready(): + rng.randomize() + self.rotate(rng.randf_range(0,360)) + +# Called every frame. 'delta' is the elapsed time since the previous frame. +#func _process(delta): +# pass diff --git a/src/mechanics/Arrow.png b/src/mechanics/Arrow.png new file mode 100644 index 0000000..6a95cff --- /dev/null +++ b/src/mechanics/Arrow.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0842c896f21f87347c70f1feab8f05f4046277f947db107a97ff843d395c1abf +size 892 diff --git a/src/mechanics/Arrow.png.import b/src/mechanics/Arrow.png.import new file mode 100644 index 0000000..e6919df --- /dev/null +++ b/src/mechanics/Arrow.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/Arrow.png-c74a2890a5d000583b97def8c477171b.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://src/mechanics/Arrow.png" +dest_files=[ "res://.import/Arrow.png-c74a2890a5d000583b97def8c477171b.stex" ] + +[params] + +compress/mode=0 +compress/lossy_quality=0.7 +compress/hdr_mode=0 +compress/bptc_ldr=0 +compress/normal_map=0 +flags/repeat=0 +flags/filter=true +flags/mipmaps=false +flags/anisotropic=false +flags/srgb=2 +process/fix_alpha_border=true +process/premult_alpha=false +process/HDR_as_SRGB=false +process/invert_color=false +stream=false +size_limit=0 +detect_3d=true +svg/scale=1.0 diff --git a/src/mechanics/Branch1.png b/src/mechanics/Branch1.png new file mode 100644 index 0000000..aea67b7 --- /dev/null +++ b/src/mechanics/Branch1.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e6ffdd6cf789b494f395b0a1b49ed7ad59e5aea85ca0a50067fb2dbe696278c2 +size 1112 diff --git a/src/mechanics/Branch1.png.import b/src/mechanics/Branch1.png.import new file mode 100644 index 0000000..ce02367 --- /dev/null +++ b/src/mechanics/Branch1.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/Branch1.png-99f09072e85d1a5bd66b495d591945f1.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://src/mechanics/Branch1.png" +dest_files=[ "res://.import/Branch1.png-99f09072e85d1a5bd66b495d591945f1.stex" ] + +[params] + +compress/mode=0 +compress/lossy_quality=0.7 +compress/hdr_mode=0 +compress/bptc_ldr=0 +compress/normal_map=0 +flags/repeat=0 +flags/filter=true +flags/mipmaps=false +flags/anisotropic=false +flags/srgb=2 +process/fix_alpha_border=true +process/premult_alpha=false +process/HDR_as_SRGB=false +process/invert_color=false +stream=false +size_limit=0 +detect_3d=true +svg/scale=1.0