item-info
John Montagu, the 4th Earl of Sandvich 2022-11-18 13:53:51 -08:00
parent 39894f63a8
commit 613925b085
Signed by: sandvich
GPG Key ID: 9A39BE37E602B22D
11 changed files with 54 additions and 9 deletions

View File

@ -5,7 +5,7 @@ namespace SupaLidlGame.Characters
public partial class Character : CharacterBody2D
{
[Export]
public float Speed { get; protected set; } = 128.0f;
public float Speed { get; protected set; } = 32.0f;
[Export]
public float Mass

View File

@ -15,7 +15,6 @@ size = Vector2(32, 32)
[node name="ExampleEnemy" type="CharacterBody2D" node_paths=PackedStringArray("StateMachine")]
script = ExtResource("1_4x3dm")
Speed = 32.0
StateMachine = NodePath("StateMachine")
[node name="Icon" type="Sprite2D" parent="."]

View File

@ -1,4 +1,4 @@
[gd_scene load_steps=9 format=3 uid="uid://bncaar8vp3b84"]
[gd_scene load_steps=11 format=3 uid="uid://bncaar8vp3b84"]
[ext_resource type="Script" path="res://Characters/Player.cs" id="1_flygr"]
[ext_resource type="Texture2D" uid="uid://bw052v8ikfget" path="res://icon.svg" id="2_xmgd1"]
@ -6,6 +6,8 @@
[ext_resource type="Script" path="res://Characters/States/PlayerIdleState.cs" id="4_4k4mb"]
[ext_resource type="Script" path="res://Characters/States/PlayerMoveState.cs" id="5_tx5rw"]
[ext_resource type="Script" path="res://Characters/States/PlayerRollState.cs" id="6_6bgrj"]
[ext_resource type="PackedScene" uid="uid://cajlwb67xenfy" path="res://Items/Weapons/Sword.tscn" id="7_4rxuv"]
[ext_resource type="Script" path="res://Items/Inventory.cs" id="7_xyenu"]
[sub_resource type="RectangleShape2D" id="RectangleShape2D_bfqew"]
size = Vector2(32, 16)
@ -15,6 +17,7 @@ font_size = 24
[node name="Player" type="CharacterBody2D" node_paths=PackedStringArray("StateMachine")]
script = ExtResource("1_flygr")
Speed = 64.0
StateMachine = NodePath("StateMachine")
[node name="Sprite2D" type="Sprite2D" parent="."]
@ -64,3 +67,7 @@ horizontal_alignment = 1
[node name="Node" type="Node" parent="."]
[node name="Inventory" type="Node2D" parent="."]
script = ExtResource("7_xyenu")
[node name="Sword" parent="Inventory" instance=ExtResource("7_4rxuv")]
position = Vector2(21, 0)

View File

@ -26,13 +26,12 @@ namespace SupaLidlGame.Characters.State
return null;
}
public override CharacterState Input(Godot.InputEvent @event)
public override CharacterState Input(InputEvent @event)
{
if (@event.IsActionPressed("roll"))
{
return RollState;
}
return null;
}
}

View File

@ -55,6 +55,13 @@ namespace SupaLidlGame.Items
public override void _Ready()
{
Owner = GetParent<Character>();
foreach (Node child in GetChildren())
{
if (child is Item item)
{
Items.Add(item);
}
}
base._Ready();
}
}

View File

@ -1,11 +1,13 @@
using Godot;
using SupaLidlGame.BoundingBoxes;
using SupaLidlGame.Characters;
namespace SupaLidlGame.Items.Weapons
{
public partial class Sword : Weapon
{
//[Export]
//public Damagebox
[Export]
public Hitbox Hitbox { get; set; }
public override void Equip(Character character)
{
@ -14,7 +16,12 @@ namespace SupaLidlGame.Items.Weapons
public override void Use()
{
//base.Use();
Hitbox.IsEnabled = true;
}
public override void Deuse()
{
Hitbox.IsEnabled = false;
}
}
}

View File

@ -0,0 +1,26 @@
[gd_scene load_steps=5 format=3 uid="uid://cajlwb67xenfy"]
[ext_resource type="Script" path="res://Items/Weapons/Sword.cs" id="1_mlo73"]
[ext_resource type="Texture2D" uid="uid://dt6u8p4h6g7le" path="res://Sprites/knife.png" id="2_dmsp2"]
[ext_resource type="PackedScene" uid="uid://du5vhccg75nrq" path="res://BoundingBoxes/Hitbox.tscn" id="3_up3ob"]
[sub_resource type="CapsuleShape2D" id="CapsuleShape2D_yln58"]
radius = 8.0
height = 24.0
[node name="Sword" type="Node2D" node_paths=PackedStringArray("Hitbox")]
texture_filter = 3
script = ExtResource("1_mlo73")
Hitbox = NodePath("Hitbox")
[node name="Sprite2D" type="Sprite2D" parent="."]
texture = ExtResource("2_dmsp2")
[node name="Hitbox" parent="." instance=ExtResource("3_up3ob")]
[node name="CollisionShape2D" parent="Hitbox" index="0"]
shape = SubResource("CapsuleShape2D_yln58")
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
[editable path="Hitbox"]

View File

@ -1136,7 +1136,6 @@ layer_3/tile_data = PackedInt32Array(-458765, 393216, 1, -393229, 327680, 0, -39
position = Vector2(-81, -34)
scale = Vector2(0.25, 0.25)
motion_mode = 1
Speed = 64.0
[node name="ExampleEnemy" parent="TileMap" instance=ExtResource("2_uti3y")]
position = Vector2(-4, 60)

View File

@ -48,6 +48,7 @@ ui_down={
roll={
"deadzone": 0.5,
"events": [Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"button_mask":0,"position":Vector2(0, 0),"global_position":Vector2(0, 0),"factor":1.0,"button_index":3,"pressed":false,"double_click":false,"script":null)
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":32,"unicode":0,"echo":false,"script":null)
]
}