Compare commits
No commits in common. "0b06b055fffe50c2cc9cf98a21f2f4d18afed466" and "18ed66e795f2409a499bf4d367a01ac4882d02d2" have entirely different histories.
0b06b055ff
...
18ed66e795
@ -1,22 +1,12 @@
|
||||
extends CharacterBody2D
|
||||
class_name Player
|
||||
|
||||
signal player_stats_updated(player : Player)
|
||||
|
||||
@export var speed = 400
|
||||
|
||||
var energy : int = 10 :
|
||||
set(v):
|
||||
energy = v
|
||||
emit_signal("player_stats_updated", self)
|
||||
|
||||
func _ready():
|
||||
emit_signal("player_stats_updated", self)
|
||||
|
||||
func get_input():
|
||||
calculate_direction()
|
||||
|
||||
if Input.is_action_just_pressed("interact") and energy > 0:
|
||||
if Input.is_action_just_pressed("interact"):
|
||||
try_interact()
|
||||
|
||||
func calculate_direction():
|
||||
@ -36,12 +26,10 @@ func try_interact():
|
||||
if len(interactables) > 1:
|
||||
# Sort them to the closer
|
||||
interactables.sort_custom(
|
||||
func (el1 : Interactable, el2 : Interactable):
|
||||
return el1.global_position.distance_to(global_position) > el2.global_position.distance_to(global_position)
|
||||
func (el : Interactable): return el.global_position.distance_to(global_position)
|
||||
)
|
||||
|
||||
interactables[0].interact(self)
|
||||
energy -= 1
|
||||
|
||||
func _physics_process(_delta):
|
||||
get_input()
|
||||
|
||||
@ -1 +0,0 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="#ffffff" class="icon icon-tabler icons-tabler-filled icon-tabler-bolt"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M13 2l.018 .001l.016 .001l.083 .005l.011 .002h.011l.038 .009l.052 .008l.016 .006l.011 .001l.029 .011l.052 .014l.019 .009l.015 .004l.028 .014l.04 .017l.021 .012l.022 .01l.023 .015l.031 .017l.034 .024l.018 .011l.013 .012l.024 .017l.038 .034l.022 .017l.008 .01l.014 .012l.036 .041l.026 .027l.006 .009c.12 .147 .196 .322 .218 .513l.001 .012l.002 .041l.004 .064v6h5a1 1 0 0 1 .868 1.497l-.06 .091l-8 11c-.568 .783 -1.808 .38 -1.808 -.588v-6h-5a1 1 0 0 1 -.868 -1.497l.06 -.091l8 -11l.01 -.013l.018 -.024l.033 -.038l.018 -.022l.009 -.008l.013 -.014l.04 -.036l.028 -.026l.008 -.006a1 1 0 0 1 .402 -.199l.011 -.001l.027 -.005l.074 -.013l.011 -.001l.041 -.002z" /></svg>
|
||||
|
Before Width: | Height: | Size: 887 B |
@ -1,37 +0,0 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://dcgnamu7sb3ov"
|
||||
path="res://.godot/imported/bolt.svg-346ec638bad7861a6c0a47abfe0480f6.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://gui/player_info/assets/icons/bolt.svg"
|
||||
dest_files=["res://.godot/imported/bolt.svg-346ec638bad7861a6c0a47abfe0480f6.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
|
||||
svg/scale=1.0
|
||||
editor/scale_with_editor_scale=false
|
||||
editor/convert_colors_with_editor_theme=false
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 294 KiB |
@ -1,34 +0,0 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://cm3ehinvvj52i"
|
||||
path="res://.godot/imported/Interface sans boutons.png-6f58a6b9570fde0ac2945334970770a8.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://gui/player_info/assets/texture/Interface sans boutons.png"
|
||||
dest_files=["res://.godot/imported/Interface sans boutons.png-6f58a6b9570fde0ac2945334970770a8.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
|
||||
@ -1,62 +0,0 @@
|
||||
[gd_scene load_steps=6 format=3 uid="uid://baqrmhsgqda6v"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://bpqh8n0lbluf8" path="res://gui/player_info/scripts/player_info.gd" id="1_ghu0s"]
|
||||
[ext_resource type="Texture2D" uid="uid://cm3ehinvvj52i" path="res://gui/player_info/assets/texture/Interface sans boutons.png" id="2_cgy6f"]
|
||||
[ext_resource type="Texture2D" uid="uid://dcgnamu7sb3ov" path="res://gui/player_info/assets/icons/bolt.svg" id="3_s4ggy"]
|
||||
[ext_resource type="FontFile" uid="uid://byyfovm1ha5ya" path="res://gui/ressources/fonts/AtomicMd-3zXDZ.ttf" id="4_5y5ny"]
|
||||
|
||||
[sub_resource type="LabelSettings" id="LabelSettings_bye71"]
|
||||
font = ExtResource("4_5y5ny")
|
||||
font_size = 25
|
||||
|
||||
[node name="PlayerInfo" type="Control"]
|
||||
custom_minimum_size = Vector2(337, 160)
|
||||
layout_mode = 3
|
||||
anchor_right = 0.293
|
||||
anchor_bottom = 0.247
|
||||
offset_right = -0.536011
|
||||
offset_bottom = -0.0559998
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
size_flags_horizontal = 0
|
||||
size_flags_vertical = 0
|
||||
script = ExtResource("1_ghu0s")
|
||||
|
||||
[node name="Background" type="TextureRect" parent="."]
|
||||
layout_mode = 1
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
texture = ExtResource("2_cgy6f")
|
||||
expand_mode = 2
|
||||
stretch_mode = 5
|
||||
|
||||
[node name="EnergyInfo" type="HBoxContainer" parent="."]
|
||||
layout_mode = 1
|
||||
anchors_preset = -1
|
||||
anchor_left = 0.281899
|
||||
anchor_top = 0.384375
|
||||
anchor_right = 0.281899
|
||||
anchor_bottom = 0.584375
|
||||
offset_left = -44.0
|
||||
offset_top = -12.5
|
||||
offset_right = 44.0
|
||||
offset_bottom = 12.5
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
metadata/_edit_use_anchors_ = true
|
||||
|
||||
[node name="Icon" type="TextureRect" parent="EnergyInfo"]
|
||||
custom_minimum_size = Vector2(36.64, 0)
|
||||
layout_mode = 2
|
||||
texture = ExtResource("3_s4ggy")
|
||||
stretch_mode = 5
|
||||
|
||||
[node name="Label" type="Label" parent="EnergyInfo"]
|
||||
layout_mode = 2
|
||||
text = "0"
|
||||
label_settings = SubResource("LabelSettings_bye71")
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
@ -1,4 +0,0 @@
|
||||
extends Control
|
||||
|
||||
func _on_root_gui_player_stats_updated(player:Player):
|
||||
$EnergyInfo/Label.text = str(player.energy)
|
||||
@ -1 +0,0 @@
|
||||
uid://bpqh8n0lbluf8
|
||||
Binary file not shown.
@ -1,35 +0,0 @@
|
||||
[remap]
|
||||
|
||||
importer="font_data_dynamic"
|
||||
type="FontFile"
|
||||
uid="uid://byyfovm1ha5ya"
|
||||
path="res://.godot/imported/AtomicMd-3zXDZ.ttf-0d8ee2c5d0b5b97084be121e0cf9710b.fontdata"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://gui/ressources/fonts/AtomicMd-3zXDZ.ttf"
|
||||
dest_files=["res://.godot/imported/AtomicMd-3zXDZ.ttf-0d8ee2c5d0b5b97084be121e0cf9710b.fontdata"]
|
||||
|
||||
[params]
|
||||
|
||||
Rendering=null
|
||||
antialiasing=1
|
||||
generate_mipmaps=false
|
||||
disable_embedded_bitmaps=true
|
||||
multichannel_signed_distance_field=false
|
||||
msdf_pixel_range=8
|
||||
msdf_size=48
|
||||
allow_system_fallback=true
|
||||
force_autohinter=false
|
||||
hinting=1
|
||||
subpixel_positioning=4
|
||||
keep_rounding_remainders=true
|
||||
oversampling=0.0
|
||||
Fallbacks=null
|
||||
fallbacks=[]
|
||||
Compress=null
|
||||
compress=true
|
||||
preload=[]
|
||||
language_support={}
|
||||
script_support={}
|
||||
opentype_features={}
|
||||
@ -1,27 +0,0 @@
|
||||
[gd_scene load_steps=3 format=3 uid="uid://12nak7amd1uq"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://baqrmhsgqda6v" path="res://gui/player_info/player_info.tscn" id="1_8kw6x"]
|
||||
[ext_resource type="Script" uid="uid://cqao7n800qy40" path="res://gui/scripts/root_gui.gd" id="1_udau0"]
|
||||
|
||||
[node name="RootGui" type="Control"]
|
||||
layout_mode = 3
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
script = ExtResource("1_udau0")
|
||||
|
||||
[node name="PlayerInfo" parent="." instance=ExtResource("1_8kw6x")]
|
||||
layout_mode = 1
|
||||
anchors_preset = 0
|
||||
anchor_right = 0.0
|
||||
anchor_bottom = 0.0
|
||||
offset_right = 337.0
|
||||
offset_bottom = 160.0
|
||||
grow_horizontal = 1
|
||||
grow_vertical = 1
|
||||
|
||||
[connection signal="player_stats_updated" from="." to="PlayerInfo" method="_on_root_gui_player_stats_updated"]
|
||||
@ -1,7 +0,0 @@
|
||||
extends Control
|
||||
class_name RootGui
|
||||
|
||||
signal player_stats_updated(player : Player)
|
||||
|
||||
func _on_player_player_stats_updated(player:Player):
|
||||
emit_signal("player_stats_updated", player)
|
||||
@ -1 +0,0 @@
|
||||
uid://cqao7n800qy40
|
||||
31
root.tscn
31
root.tscn
@ -1,6 +1,5 @@
|
||||
[gd_scene load_steps=6 format=3 uid="uid://c5bruelvqbm1k"]
|
||||
[gd_scene load_steps=5 format=3 uid="uid://c5bruelvqbm1k"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://12nak7amd1uq" path="res://gui/root_gui.tscn" id="1_jnlp7"]
|
||||
[ext_resource type="PackedScene" uid="uid://tsi5j1uxppa4" path="res://stages/planet/planet.tscn" id="1_pyidc"]
|
||||
[ext_resource type="PackedScene" uid="uid://bgvbgeq46wee2" path="res://entities/player/player.tscn" id="2_vvh5c"]
|
||||
[ext_resource type="PackedScene" uid="uid://dj7gp3crtg2yt" path="res://entities/camera/camera.tscn" id="3_vvh5c"]
|
||||
@ -8,10 +7,6 @@
|
||||
|
||||
[node name="Root" type="Node2D"]
|
||||
|
||||
[node name="CanvasLayer" type="CanvasLayer" parent="."]
|
||||
|
||||
[node name="RootGui" parent="CanvasLayer" instance=ExtResource("1_jnlp7")]
|
||||
|
||||
[node name="Planet" parent="." instance=ExtResource("1_pyidc")]
|
||||
|
||||
[node name="Player" parent="." instance=ExtResource("2_vvh5c")]
|
||||
@ -20,36 +15,32 @@
|
||||
position = Vector2(2.22, 0)
|
||||
following = NodePath("../Player")
|
||||
|
||||
[node name="TestPlants" type="Node2D" parent="."]
|
||||
|
||||
[node name="DefaultPlant" parent="TestPlants" instance=ExtResource("4_28aoi")]
|
||||
[node name="DefaultPlant" parent="." instance=ExtResource("4_28aoi")]
|
||||
position = Vector2(195, 37)
|
||||
|
||||
[node name="DefaultPlant2" parent="TestPlants" instance=ExtResource("4_28aoi")]
|
||||
[node name="DefaultPlant2" parent="." instance=ExtResource("4_28aoi")]
|
||||
position = Vector2(114, -40)
|
||||
|
||||
[node name="DefaultPlant3" parent="TestPlants" instance=ExtResource("4_28aoi")]
|
||||
[node name="DefaultPlant3" parent="." instance=ExtResource("4_28aoi")]
|
||||
position = Vector2(-222, 138)
|
||||
|
||||
[node name="DefaultPlant4" parent="TestPlants" instance=ExtResource("4_28aoi")]
|
||||
[node name="DefaultPlant4" parent="." instance=ExtResource("4_28aoi")]
|
||||
position = Vector2(-186, -96)
|
||||
|
||||
[node name="DefaultPlant5" parent="TestPlants" instance=ExtResource("4_28aoi")]
|
||||
[node name="DefaultPlant5" parent="." instance=ExtResource("4_28aoi")]
|
||||
position = Vector2(-7, 150)
|
||||
|
||||
[node name="DefaultPlant6" parent="TestPlants" instance=ExtResource("4_28aoi")]
|
||||
[node name="DefaultPlant6" parent="." instance=ExtResource("4_28aoi")]
|
||||
position = Vector2(-19, -102)
|
||||
|
||||
[node name="DefaultPlant7" parent="TestPlants" instance=ExtResource("4_28aoi")]
|
||||
[node name="DefaultPlant7" parent="." instance=ExtResource("4_28aoi")]
|
||||
position = Vector2(-115, 50)
|
||||
|
||||
[node name="DefaultPlant8" parent="TestPlants" instance=ExtResource("4_28aoi")]
|
||||
[node name="DefaultPlant8" parent="." instance=ExtResource("4_28aoi")]
|
||||
position = Vector2(147, -173)
|
||||
|
||||
[node name="DefaultPlant9" parent="TestPlants" instance=ExtResource("4_28aoi")]
|
||||
[node name="DefaultPlant9" parent="." instance=ExtResource("4_28aoi")]
|
||||
position = Vector2(98, 90)
|
||||
|
||||
[node name="DefaultPlant10" parent="TestPlants" instance=ExtResource("4_28aoi")]
|
||||
[node name="DefaultPlant10" parent="." instance=ExtResource("4_28aoi")]
|
||||
position = Vector2(-269, 1)
|
||||
|
||||
[connection signal="player_stats_updated" from="Player" to="CanvasLayer/RootGui" method="_on_player_player_stats_updated"]
|
||||
|
||||
Loading…
Reference in New Issue
Block a user