Heck yeah, you punch those trees, Gary!
This commit is contained in:
11
tree/small_tree.gd
Normal file
11
tree/small_tree.gd
Normal file
@@ -0,0 +1,11 @@
|
||||
extends Area2D
|
||||
|
||||
var _durability: int = 3
|
||||
|
||||
func _on_body_entered(body: Node2D) -> void:
|
||||
if body is CharacterBody2D:
|
||||
_durability -= 1
|
||||
body.repel_collision(self)
|
||||
if _durability <= 0:
|
||||
print("tree dead")
|
||||
queue_free()
|
||||
1
tree/small_tree.gd.uid
Normal file
1
tree/small_tree.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://clxosihgty8t5
|
||||
BIN
tree/small_tree.png
Normal file
BIN
tree/small_tree.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.6 KiB |
34
tree/small_tree.png.import
Normal file
34
tree/small_tree.png.import
Normal file
@@ -0,0 +1,34 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://bfyw8l1ubdnsj"
|
||||
path="res://.godot/imported/small_tree.png-6b7409adbeafd078c10945c05a21c2ab.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://tree/small_tree.png"
|
||||
dest_files=["res://.godot/imported/small_tree.png-6b7409adbeafd078c10945c05a21c2ab.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
|
||||
21
tree/small_tree.tscn
Normal file
21
tree/small_tree.tscn
Normal file
@@ -0,0 +1,21 @@
|
||||
[gd_scene load_steps=4 format=3 uid="uid://d2re5mee0xayj"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://bfyw8l1ubdnsj" path="res://tree/small_tree.png" id="1_1ao6o"]
|
||||
[ext_resource type="Script" uid="uid://clxosihgty8t5" path="res://tree/small_tree.gd" id="1_brd4x"]
|
||||
|
||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_vb5bs"]
|
||||
size = Vector2(32, 32)
|
||||
|
||||
[node name="Tree" type="Area2D"]
|
||||
script = ExtResource("1_brd4x")
|
||||
|
||||
[node name="Sprite2D" type="Sprite2D" parent="."]
|
||||
texture = ExtResource("1_1ao6o")
|
||||
offset = Vector2(16, 16)
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||
visible = false
|
||||
position = Vector2(16, 16)
|
||||
shape = SubResource("RectangleShape2D_vb5bs")
|
||||
|
||||
[connection signal="body_entered" from="." to="." method="_on_body_entered"]
|
||||
BIN
tree/small_tree.xcf
Normal file
BIN
tree/small_tree.xcf
Normal file
Binary file not shown.
Reference in New Issue
Block a user