Activables

This commit is contained in:
MaddoScientisto 2024-06-10 22:29:41 +02:00
commit bfe42b460b
9 changed files with 142 additions and 7 deletions

21
Scenes/Activable.cs Normal file
View file

@ -0,0 +1,21 @@
using Godot;
using System;
using System.Diagnostics;
public partial class Activable : Area2D
{
// Called when the node enters the scene tree for the first time.
public override void _Ready()
{
}
// Called every frame. 'delta' is the elapsed time since the previous frame.
public override void _Process(double delta)
{
}
public void Activate()
{
Debug.WriteLine("Activated");
}
}

39
Scenes/Detritus.tscn Normal file
View file

@ -0,0 +1,39 @@
[gd_scene load_steps=6 format=3 uid="uid://c53lpgcvld227"]
[ext_resource type="Script" path="res://Scenes/Barrel.cs" id="1_6ig5i"]
[ext_resource type="PackedScene" uid="uid://jmijre3eaf8m" path="res://Scenes/Explosion.tscn" id="3_o4o8g"]
[ext_resource type="Texture2D" uid="uid://chklctdgv6twk" path="res://Sprites/Detritus.png" id="4_brq2k"]
[sub_resource type="RectangleShape2D" id="RectangleShape2D_2ewfl"]
size = Vector2(11, 14)
[sub_resource type="RectangleShape2D" id="RectangleShape2D_ss2y0"]
size = Vector2(11, 14)
[node name="Detritus" type="Area2D" groups=["Destroyable"]]
collision_layer = 64
collision_mask = 10
script = ExtResource("1_6ig5i")
Health = 2.0
ExplosionRadius = 2.0
ExplosionDamage = 2.0
ExplosionParticles = ExtResource("3_o4o8g")
metadata/_edit_group_ = true
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
visible = false
position = Vector2(0.5, -1)
shape = SubResource("RectangleShape2D_2ewfl")
[node name="Sprite2D" type="Sprite2D" parent="."]
texture = ExtResource("4_brq2k")
[node name="RigidBody2D" type="RigidBody2D" parent="."]
collision_layer = 64
collision_mask = 10
gravity_scale = 0.0
[node name="CollisionShape2D" type="CollisionShape2D" parent="RigidBody2D"]
visible = false
position = Vector2(0.5, -1)
shape = SubResource("RectangleShape2D_ss2y0")

11
Scenes/Door.tscn Normal file
View file

@ -0,0 +1,11 @@
[gd_scene load_steps=3 format=3 uid="uid://bqq3q37hugdlj"]
[ext_resource type="Script" path="res://Scenes/Activable.cs" id="1_r61rk"]
[sub_resource type="RectangleShape2D" id="RectangleShape2D_ul0l3"]
[node name="Door" type="Area2D"]
script = ExtResource("1_r61rk")
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
shape = SubResource("RectangleShape2D_ul0l3")

View file

@ -1,7 +1,9 @@
[gd_scene load_steps=5 format=3 uid="uid://uaf5r6cd71hu"]
[gd_scene load_steps=8 format=3 uid="uid://uaf5r6cd71hu"]
[ext_resource type="Script" path="res://Scenes/Barrel.cs" id="1_7ckvo"]
[ext_resource type="Texture2D" uid="uid://d2rvjbllnogx4" path="res://Sprites/LargeTank.png" id="1_7h6ee"]
[ext_resource type="PackedScene" uid="uid://c53lpgcvld227" path="res://Scenes/Detritus.tscn" id="2_wpybp"]
[ext_resource type="PackedScene" uid="uid://jmijre3eaf8m" path="res://Scenes/Explosion.tscn" id="3_2db64"]
[sub_resource type="AtlasTexture" id="AtlasTexture_i3nxh"]
atlas = ExtResource("1_7h6ee")
@ -10,11 +12,16 @@ region = Rect2(0, 0, 64, 64)
[sub_resource type="RectangleShape2D" id="RectangleShape2D_0nhpj"]
size = Vector2(61, 61)
[sub_resource type="RectangleShape2D" id="RectangleShape2D_s3n6b"]
size = Vector2(60, 57)
[node name="LargeTank" type="Area2D"]
collision_layer = 65
collision_mask = 11
script = ExtResource("1_7ckvo")
Health = 4.0
DebrisScene = ExtResource("2_wpybp")
ExplosionParticles = ExtResource("3_2db64")
[node name="Sprite2D" type="Sprite2D" parent="."]
texture = SubResource("AtlasTexture_i3nxh")
@ -23,3 +30,9 @@ texture = SubResource("AtlasTexture_i3nxh")
visible = false
position = Vector2(0.5, -0.5)
shape = SubResource("RectangleShape2D_0nhpj")
[node name="RigidBody2D" type="RigidBody2D" parent="."]
[node name="CollisionShape2D" type="CollisionShape2D" parent="RigidBody2D"]
position = Vector2(0, 1.5)
shape = SubResource("RectangleShape2D_s3n6b")

View file

@ -4,6 +4,8 @@ using System.Diagnostics;
public partial class Interactable : Area2D
{
[Export] public Activable Target { get; set; }
// Called when the node enters the scene tree for the first time.
public override void _Ready()
{

File diff suppressed because one or more lines are too long

BIN
Sprites/Detritus.aseprite (Stored with Git LFS) Normal file

Binary file not shown.

BIN
Sprites/Detritus.png (Stored with Git LFS) Normal file

Binary file not shown.

View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://chklctdgv6twk"
path="res://.godot/imported/Detritus.png-fa765afd1575177b1d1eb5905b000dad.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://Sprites/Detritus.png"
dest_files=["res://.godot/imported/Detritus.png-fa765afd1575177b1d1eb5905b000dad.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1