prework for buff system
							parent
							
								
									996b49ab93
								
							
						
					
					
						commit
						00be67d787
					
				|  | @ -396,16 +396,6 @@ public partial class Character : CharacterBody2D, IFaction | |||
|         bus.EmitSignal(Events.EventBus.SignalName.PlayerHit, newArgs); | ||||
|     } | ||||
| 
 | ||||
| #if DEBUG | ||||
|     /// <summary> | ||||
|     /// For debugging purposes | ||||
|     /// </summary> | ||||
|     public void Inflict(float damage) | ||||
|     { | ||||
|         OnReceivedDamage(damage, null, 0); | ||||
|     } | ||||
| #endif | ||||
| 
 | ||||
|     /// <summary> | ||||
|     /// Plays a footstep sound. This should be called through an | ||||
|     /// <c>AnimationPlayer</c> to sync sounds with animations. | ||||
|  |  | |||
|  | @ -693,6 +693,8 @@ libraries = { | |||
| "": SubResource("AnimationLibrary_kks2p") | ||||
| } | ||||
| 
 | ||||
| [node name="Buffs" type="Node2D" parent="."] | ||||
| 
 | ||||
| [node name="Effects" type="Node2D" parent="."] | ||||
| unique_name_in_owner = true | ||||
| 
 | ||||
|  |  | |||
|  | @ -10,7 +10,7 @@ | |||
| radius = 20.0 | ||||
| 
 | ||||
| [sub_resource type="RectangleShape2D" id="RectangleShape2D_bw3hg"] | ||||
| size = Vector2(20, 23) | ||||
| size = Vector2(20, 16) | ||||
| 
 | ||||
| [node name="Campfire" type="StaticBody2D"] | ||||
| texture_filter = 3 | ||||
|  | @ -46,7 +46,6 @@ offset_bottom = -19.0 | |||
| text = "Clone Machine" | ||||
| 
 | ||||
| [node name="CollisionShape2D" type="CollisionShape2D" parent="."] | ||||
| position = Vector2(0, -3.5) | ||||
| shape = SubResource("RectangleShape2D_bw3hg") | ||||
| 
 | ||||
| [editable path="InteractionTrigger"] | ||||
|  |  | |||
|  | @ -43,8 +43,8 @@ public partial class Projectile : RigidBody2D | |||
|     [Export] | ||||
|     public double Delay { get; set; } = 0; | ||||
| 
 | ||||
|     [System.Obsolete] | ||||
|     public Character Character { get; set; } | ||||
|     [Export(PropertyHint.File, "*.tscn")] | ||||
|     public Godot.Collections.Array<string> Buffs { get; set; } | ||||
| 
 | ||||
|     public Items.Weapon Weapon { get; set; } | ||||
| 
 | ||||
|  |  | |||
|  | @ -1,4 +1,4 @@ | |||
| [gd_scene load_steps=11 format=3 uid="uid://c1w7t6irnohfx"] | ||||
| [gd_scene load_steps=12 format=3 uid="uid://c1w7t6irnohfx"] | ||||
| 
 | ||||
| [ext_resource type="Texture2D" uid="uid://har1bd5u4dq3" path="res://Assets/Sprites/Misc/torch.png" id="1_14bgb"] | ||||
| [ext_resource type="Texture2D" uid="uid://coarr28adgo1u" path="res://Assets/Sprites/Particles/point-light.png" id="2_hotvd"] | ||||
|  | @ -60,6 +60,9 @@ animations = [{ | |||
| "speed": 10.0 | ||||
| }] | ||||
| 
 | ||||
| [sub_resource type="CircleShape2D" id="CircleShape2D_ljsf5"] | ||||
| radius = 4.0 | ||||
| 
 | ||||
| [node name="Torch" type="Node2D"] | ||||
| 
 | ||||
| [node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."] | ||||
|  | @ -77,3 +80,12 @@ shadow_filter_smooth = 3.0 | |||
| texture = ExtResource("2_hotvd") | ||||
| offset = Vector2(0, 2) | ||||
| texture_scale = 0.25 | ||||
| 
 | ||||
| [node name="Area2D" type="Area2D" parent="."] | ||||
| position = Vector2(0, -8) | ||||
| collision_layer = 128 | ||||
| collision_mask = 0 | ||||
| monitoring = false | ||||
| 
 | ||||
| [node name="CollisionShape2D" type="CollisionShape2D" parent="Area2D"] | ||||
| shape = SubResource("CircleShape2D_ljsf5") | ||||
|  |  | |||
|  | @ -0,0 +1,26 @@ | |||
| using Godot; | ||||
| 
 | ||||
| namespace SupaLidlGame.Items.Weapons; | ||||
| 
 | ||||
| public partial class Bow : ProjectileSpawner | ||||
| { | ||||
|     protected bool _isOnFire = false; | ||||
| 
 | ||||
|     protected Area2D _ignitionArea; | ||||
| 
 | ||||
|     protected override void SpawnProjectile(Scenes.Map map, | ||||
|         Vector2 direction, float velocityModifier = 1) | ||||
|     { | ||||
|         base.SpawnProjectile(map, direction, velocityModifier); | ||||
|     } | ||||
| 
 | ||||
|     public override void _Ready() | ||||
|     { | ||||
|         base._Ready(); | ||||
|         _ignitionArea = GetNode<Area2D>("IgnitionArea"); | ||||
|         _ignitionArea.AreaEntered += (Area2D area) => | ||||
|         { | ||||
|             _isOnFire = false; | ||||
|         }; | ||||
|     } | ||||
| } | ||||
|  | @ -1,4 +1,4 @@ | |||
| [gd_scene load_steps=15 format=3 uid="uid://cgg0sfm2qeiwn"] | ||||
| [gd_scene load_steps=16 format=3 uid="uid://cgg0sfm2qeiwn"] | ||||
| 
 | ||||
| [ext_resource type="Texture2D" uid="uid://dam6aigkw8xs" path="res://Assets/Sprites/Items/bow-and-arrow.png" id="1_1ghvv"] | ||||
| [ext_resource type="Script" path="res://Items/Weapons/ProjectileSpawner.cs" id="1_76bur"] | ||||
|  | @ -109,6 +109,8 @@ _data = { | |||
| "idle": SubResource("Animation_riv7t") | ||||
| } | ||||
| 
 | ||||
| [sub_resource type="CircleShape2D" id="CircleShape2D_6b356"] | ||||
| 
 | ||||
| [node name="Bow" type="Node2D" node_paths=PackedStringArray("StateMachine")] | ||||
| y_sort_enabled = true | ||||
| script = ExtResource("1_76bur") | ||||
|  | @ -170,3 +172,12 @@ libraries = { | |||
| [node name="AudioStreamPlayer2D" type="AudioStreamPlayer2D" parent="."] | ||||
| volume_db = -8.0 | ||||
| bus = &"Effects" | ||||
| 
 | ||||
| [node name="IgnitionArea" type="Area2D" parent="."] | ||||
| position = Vector2(8, 0) | ||||
| collision_layer = 0 | ||||
| collision_mask = 128 | ||||
| monitorable = false | ||||
| 
 | ||||
| [node name="CollisionShape2D" type="CollisionShape2D" parent="IgnitionArea"] | ||||
| shape = SubResource("CircleShape2D_6b356") | ||||
|  |  | |||
|  | @ -24,7 +24,8 @@ public partial class ProjectileSpawner : Ranged | |||
|     [Export] | ||||
|     public float ProjectileAngleDeviation { get; set; } | ||||
| 
 | ||||
|     private void SpawnProjectile(Scenes.Map map, Vector2 direction, float v = 1) | ||||
|     protected virtual void SpawnProjectile(Scenes.Map map, | ||||
|         Vector2 direction, float velocityModifier = 1) | ||||
|     { | ||||
|         var projectile = map.SpawnEntity<Entities.Projectile>(Projectile); | ||||
|         projectile.Hitbox.Faction = Character.Faction; | ||||
|  | @ -33,7 +34,7 @@ public partial class ProjectileSpawner : Ranged | |||
| 
 | ||||
|         if (ShouldOverrideVelocity) | ||||
|         { | ||||
|             projectile.Speed = InitialVelocity * v; | ||||
|             projectile.Speed = InitialVelocity * velocityModifier; | ||||
|         } | ||||
| 
 | ||||
|         if (ShouldRotate) | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue