1
Fork 0
mirror of https://github.com/Steffo99/hella-farm.git synced 2024-10-16 14:27:36 +00:00

Add gold nugget

This commit is contained in:
Lorenzo Rossi 2024-04-13 19:07:26 +02:00
parent d4c844e878
commit df683f3141
6 changed files with 86 additions and 2 deletions

18
entities/gold.gd Normal file
View file

@ -0,0 +1,18 @@
extends Node2D
## Emitted when the player hoveres the nugget
signal hovered
# Called when the node enters the scene tree for the first time.
func _ready():
pass # Replace with function body.
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta):
pass
func _on_area_2d_mouse_entered():
hovered.emit()
print("Hovered")

21
entities/gold.tscn Normal file
View file

@ -0,0 +1,21 @@
[gd_scene load_steps=4 format=3 uid="uid://uoxwjpmgg27a"]
[ext_resource type="Script" path="res://entities/gold.gd" id="1_lbls1"]
[ext_resource type="Texture2D" uid="uid://d3o13ebmcux2d" path="res://media/nugget.png" id="2_d322a"]
[sub_resource type="CircleShape2D" id="CircleShape2D_bjgas"]
radius = 16.4012
[node name="Gold" type="Node2D"]
script = ExtResource("1_lbls1")
[node name="Nugget" type="Sprite2D" parent="."]
position = Vector2(1, 0)
texture = ExtResource("2_d322a")
[node name="Area2D" type="Area2D" parent="."]
[node name="CollisionShape2D" type="CollisionShape2D" parent="Area2D"]
shape = SubResource("CircleShape2D_bjgas")
[connection signal="mouse_entered" from="Area2D" to="." method="_on_area_2d_mouse_entered"]

View file

@ -58,7 +58,6 @@ func _process(delta):
func _physics_process(delta):
gravity_scale = 0
print(linear_velocity.length())
if state == State.STATE_THROWN and linear_velocity.length() < 300:
linear_velocity = Vector2.ZERO
state = State.STATE_WALK

BIN
media/nugget.png (Stored with Git LFS) Normal file

Binary file not shown.

34
media/nugget.png.import Normal file
View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://d3o13ebmcux2d"
path="res://.godot/imported/nugget.png-5b98c47cf6ba2c12cc0579f784634817.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://media/nugget.png"
dest_files=["res://.godot/imported/nugget.png-5b98c47cf6ba2c12cc0579f784634817.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

View file

@ -1,7 +1,8 @@
[gd_scene load_steps=4 format=3 uid="uid://cxj5aud02f40j"]
[gd_scene load_steps=5 format=3 uid="uid://cxj5aud02f40j"]
[ext_resource type="Script" path="res://scenes/game/game.gd" id="1_tau5t"]
[ext_resource type="PackedScene" uid="uid://bc2bm8lbol18w" path="res://entities/sheep.tscn" id="2_8268g"]
[ext_resource type="PackedScene" uid="uid://uoxwjpmgg27a" path="res://entities/gold.tscn" id="3_48ps6"]
[sub_resource type="TileSet" id="TileSet_g2dkm"]
@ -15,3 +16,11 @@ format = 2
[node name="Sheep" parent="." instance=ExtResource("2_8268g")]
position = Vector2(637, 318)
run_speed = 600
[node name="Gold" parent="." instance=ExtResource("3_48ps6")]
[node name="Gold2" parent="." instance=ExtResource("3_48ps6")]
position = Vector2(368, 391)
[node name="Gold3" parent="." instance=ExtResource("3_48ps6")]
position = Vector2(620, 464)