Compare commits
5 Commits
44d2491ac0
...
90d5e92740
| Author | SHA1 | Date | |
|---|---|---|---|
| 90d5e92740 | |||
| 29cac5bbc0 | |||
| 5d0104d029 | |||
| 49e16d12f8 | |||
| 52b2df8639 |
@ -14,5 +14,5 @@ func can_use(_player : Player) -> bool:
|
||||
func use_requirement_text() -> String:
|
||||
return ""
|
||||
|
||||
func use(_player : Player) -> bool:
|
||||
func use(_player : Player):
|
||||
return false
|
||||
@ -22,4 +22,5 @@ func can_use(player : Player) -> bool:
|
||||
func use(player : Player) -> bool:
|
||||
if not can_use(player):
|
||||
return false
|
||||
player.play_sfx("dig")
|
||||
return player.planet.plant(plant_type, player.global_position)
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
extends ToolItem
|
||||
class_name Shovel
|
||||
|
||||
const USE_INTERVAL = 0.15
|
||||
|
||||
func can_use(player : Player) -> bool:
|
||||
var areas = player.action_area.get_overlapping_areas()
|
||||
for area in areas :
|
||||
@ -12,10 +14,19 @@ func use(player : Player) -> bool:
|
||||
if not can_use(player):
|
||||
return false
|
||||
|
||||
var areas = player.action_area.get_overlapping_areas()
|
||||
dig(
|
||||
player.action_area.get_overlapping_areas(),
|
||||
player
|
||||
)
|
||||
|
||||
return true
|
||||
|
||||
func dig(areas: Array[Area2D], player: Player):
|
||||
for area in areas :
|
||||
if area is Plant:
|
||||
player.play_sfx("harvest")
|
||||
area.harvest()
|
||||
if area is UndergroundLoot:
|
||||
player.play_sfx("dig")
|
||||
area.dig()
|
||||
return true
|
||||
await player.get_tree().create_timer(USE_INTERVAL).timeout
|
||||
@ -20,6 +20,33 @@ corner_radius_bottom_left = 5
|
||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_coj8m"]
|
||||
size = Vector2(77, 92)
|
||||
|
||||
[sub_resource type="Animation" id="Animation_r6435"]
|
||||
length = 0.001
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("Compost:scale")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 0,
|
||||
"values": [Vector2(0.291262, 0.291262)]
|
||||
}
|
||||
tracks/1/type = "value"
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/path = NodePath("Compost:position")
|
||||
tracks/1/interp = 1
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 0,
|
||||
"values": [Vector2(0, 0)]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_1758a"]
|
||||
resource_name = "empty"
|
||||
length = 0.5
|
||||
@ -48,33 +75,6 @@ tracks/1/keys = {
|
||||
"values": [Vector2(0.291262, 0.291262), Vector2(0.291, 0.191), Vector2(0.291, 0.366), Vector2(0.291262, 0.291262)]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_r6435"]
|
||||
length = 0.001
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("Compost:scale")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 0,
|
||||
"values": [Vector2(0.291262, 0.291262)]
|
||||
}
|
||||
tracks/1/type = "value"
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/path = NodePath("Compost:position")
|
||||
tracks/1/interp = 1
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 0,
|
||||
"values": [Vector2(0, 0)]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_etofw"]
|
||||
resource_name = "fill"
|
||||
length = 0.3
|
||||
|
||||
@ -4,13 +4,13 @@ class_name Compost
|
||||
|
||||
@export var value_per_seed : float = 0.5
|
||||
|
||||
var fill_value : float = 0.
|
||||
@onready var fill_value : float = 0.
|
||||
|
||||
func _process(_delta):
|
||||
%ProgressBar.value = lerp(%ProgressBar.value, fill_value * 100, 0.5)
|
||||
|
||||
func _ready():
|
||||
fill_value = 0.
|
||||
func inspected_text():
|
||||
return "Compost"
|
||||
|
||||
func can_interact(p : Player) -> bool:
|
||||
return p.inventory.get_item() and p.inventory.get_item() is Seed
|
||||
@ -22,6 +22,7 @@ func interact(p : Player) -> bool:
|
||||
if not can_interact(p):
|
||||
return false
|
||||
|
||||
p.play_sfx("harvest")
|
||||
p.delete_item()
|
||||
fill_value += value_per_seed
|
||||
if fill_value >= 1.:
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
extends Interactable
|
||||
class_name ItemObject
|
||||
|
||||
const ITEM_AREA_WIDTH = 10
|
||||
const ITEM_AREA_WIDTH = 20
|
||||
const ITEM_SPRITE_SIZE = 40.
|
||||
const SPRITE_SCENE : PackedScene = preload("res://entities/interactables/item_object/item_object_sprite.tscn")
|
||||
|
||||
@ -19,7 +19,10 @@ func _init(_item = null):
|
||||
item = _item
|
||||
|
||||
func _ready():
|
||||
generate_collision(10)
|
||||
generate_collision(ITEM_AREA_WIDTH)
|
||||
|
||||
func inspected_text():
|
||||
return item.name + (" Seed" if item is Seed else "")
|
||||
|
||||
func interact(player : Player) -> bool:
|
||||
var swapped_item = player.inventory.get_item()
|
||||
|
||||
@ -1,11 +1,8 @@
|
||||
extends Area2D
|
||||
extends InspectableEntity
|
||||
class_name Interactable
|
||||
|
||||
var available : bool = true
|
||||
|
||||
func _ready():
|
||||
printerr("Abstract Interactable class used")
|
||||
|
||||
func can_interact(_p : Player) -> bool:
|
||||
return true
|
||||
|
||||
|
||||
@ -3,6 +3,61 @@
|
||||
[ext_resource type="Script" uid="uid://bmjjpk4lvijws" path="res://entities/plants/scripts/plant_sprite.gd" id="1_pq8o7"]
|
||||
[ext_resource type="Texture2D" uid="uid://b3wom2xu26g43" path="res://entities/plants/assets/sprites/default_plant_glowing.png" id="2_hyinx"]
|
||||
|
||||
[sub_resource type="Animation" id="Animation_wyuub"]
|
||||
length = 0.001
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("Sprite2D:scale")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 0,
|
||||
"values": [Vector2(0.15, 0.15)]
|
||||
}
|
||||
tracks/1/type = "value"
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/path = NodePath("Sprite2D:skew")
|
||||
tracks/1/interp = 1
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 0,
|
||||
"values": [0.0]
|
||||
}
|
||||
tracks/2/type = "value"
|
||||
tracks/2/imported = false
|
||||
tracks/2/enabled = true
|
||||
tracks/2/path = NodePath("Sprite2D:modulate")
|
||||
tracks/2/interp = 1
|
||||
tracks/2/loop_wrap = true
|
||||
tracks/2/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 0,
|
||||
"values": [Color(1, 1, 1, 1)]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_j6jm5"]
|
||||
resource_name = "bump"
|
||||
length = 0.5
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("Sprite2D:scale")
|
||||
tracks/0/interp = 2
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0, 0.2, 0.5),
|
||||
"transitions": PackedFloat32Array(1, 1, 1),
|
||||
"update": 0,
|
||||
"values": [Vector2(0.15, 0.15), Vector2(0.15, 0.075), Vector2(0.15, 0.15)]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_rbgiq"]
|
||||
resource_name = "harvest"
|
||||
length = 0.2
|
||||
@ -31,85 +86,6 @@ tracks/1/keys = {
|
||||
"values": [Color(1, 1, 1, 1), Color(1, 1, 1, 0)]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_j6jm5"]
|
||||
resource_name = "bump"
|
||||
length = 0.5
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("Sprite2D:scale")
|
||||
tracks/0/interp = 2
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0, 0.233333, 0.5),
|
||||
"transitions": PackedFloat32Array(1, 1, 1),
|
||||
"update": 0,
|
||||
"values": [Vector2(0.15, 0.15), Vector2(0.15, 0.075), Vector2(0.15, 0.15)]
|
||||
}
|
||||
tracks/1/type = "value"
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/path = NodePath("Sprite2D:position")
|
||||
tracks/1/interp = 2
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/keys = {
|
||||
"times": PackedFloat32Array(0, 0.233333, 0.5),
|
||||
"transitions": PackedFloat32Array(1, 1, 1),
|
||||
"update": 0,
|
||||
"values": [Vector2(0, 0), Vector2(0, 17.475), Vector2(0, 0)]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_wyuub"]
|
||||
length = 0.001
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("Sprite2D:scale")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 0,
|
||||
"values": [Vector2(0.15, 0.15)]
|
||||
}
|
||||
tracks/1/type = "value"
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/path = NodePath("Sprite2D:position")
|
||||
tracks/1/interp = 1
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 0,
|
||||
"values": [Vector2(0, 0)]
|
||||
}
|
||||
tracks/2/type = "value"
|
||||
tracks/2/imported = false
|
||||
tracks/2/enabled = true
|
||||
tracks/2/path = NodePath("Sprite2D:skew")
|
||||
tracks/2/interp = 1
|
||||
tracks/2/loop_wrap = true
|
||||
tracks/2/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 0,
|
||||
"values": [0.0]
|
||||
}
|
||||
tracks/3/type = "value"
|
||||
tracks/3/imported = false
|
||||
tracks/3/enabled = true
|
||||
tracks/3/path = NodePath("Sprite2D:modulate")
|
||||
tracks/3/interp = 1
|
||||
tracks/3/loop_wrap = true
|
||||
tracks/3/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 0,
|
||||
"values": [Color(1, 1, 1, 1)]
|
||||
}
|
||||
|
||||
[sub_resource type="AnimationLibrary" id="AnimationLibrary_8eofq"]
|
||||
_data = {
|
||||
&"RESET": SubResource("Animation_wyuub"),
|
||||
|
||||
@ -1,8 +1,7 @@
|
||||
extends Area2D
|
||||
extends InspectableEntity
|
||||
class_name Plant
|
||||
|
||||
const PLANT_AREA_WIDTH = 10
|
||||
const PLANT_SPRITE_SCALE = 0.15
|
||||
const PLANT_AREA_WIDTH = 20
|
||||
const HARVESTED_SEED_POSITION_RANGE = 100
|
||||
|
||||
const RANDOM_MAX_GROW_INTERVAL = 0.4
|
||||
@ -24,6 +23,11 @@ func _init(_plant_type = null, _planet = null):
|
||||
plant_type = _plant_type
|
||||
planet = _planet
|
||||
|
||||
func inspected_text():
|
||||
var state_text = "Growing"
|
||||
if state == State.MATURE: state_text = "Mature"
|
||||
return state_text + " " + plant_type.name
|
||||
|
||||
func generate_sprite() -> PlantSprite:
|
||||
var spriteObject : PlantSprite = SPRITE_SCENE.instantiate()
|
||||
|
||||
@ -55,9 +59,11 @@ func set_day(d):
|
||||
if day == 0:
|
||||
change_state(State.PLANTED)
|
||||
if day > plant_type.growing_time:
|
||||
change_state(State.MATURE)
|
||||
if state != State.MATURE:
|
||||
change_state(State.MATURE)
|
||||
else:
|
||||
change_state(State.GROWING)
|
||||
if state != State.GROWING:
|
||||
change_state(State.GROWING)
|
||||
|
||||
func change_state(_state: State):
|
||||
state = _state
|
||||
|
||||
@ -10,6 +10,7 @@ func apply_texture_to_sprite(texture, with_animation = true):
|
||||
$AnimationPlayer.play("bump")
|
||||
await $AnimationPlayer.animation_finished
|
||||
sprite.texture = texture
|
||||
sprite.flip_h = true if randi()%2 == 0 else false
|
||||
|
||||
func start_harvest_animation():
|
||||
$AnimationPlayer.play("harvest")
|
||||
|
||||
@ -6,7 +6,7 @@ signal action_tried_without_energy
|
||||
signal upgraded
|
||||
|
||||
var planet : Planet # mis à jour par la classe Planet
|
||||
@export var speed = 400
|
||||
@export var speed = 350
|
||||
|
||||
@onready var inventory : Inventory = Inventory.new()
|
||||
|
||||
@ -45,6 +45,24 @@ func _ready():
|
||||
emit_signal("player_updated", self)
|
||||
inventory.inventory_changed.connect(_on_inventory_updated)
|
||||
|
||||
# Méthode déclenchée par la classe planet
|
||||
func _pass_day():
|
||||
energy = max_energy
|
||||
|
||||
func _process(_delta):
|
||||
get_input()
|
||||
move_and_slide()
|
||||
detect_closest_interactable()
|
||||
|
||||
func _on_root_gui_day_pass_pressed():
|
||||
controlling_player = false
|
||||
|
||||
func _on_root_gui_day_pass_finished():
|
||||
controlling_player = true
|
||||
|
||||
func _on_root_gui_game_click():
|
||||
try_use_item()
|
||||
|
||||
func _on_inventory_updated(_inventory: Inventory):
|
||||
emit_signal("player_updated", self)
|
||||
|
||||
@ -64,7 +82,7 @@ func get_input():
|
||||
if Input.is_action_just_pressed("drop") and inventory.get_item():
|
||||
drop_item()
|
||||
if old_velocity.length()==0 and velocity.length()!=0:
|
||||
$Audio/AudioStreamPlayer_movement.play()
|
||||
play_sfx("move")
|
||||
|
||||
func calculate_direction():
|
||||
var input_direction: Vector2 = Input.get_vector("move_left", "move_right", "move_up", "move_down")
|
||||
@ -83,27 +101,25 @@ func get_item(item : Item):
|
||||
inventory.set_item(item)
|
||||
if item is ToolItem:
|
||||
add_action_area(item.generate_action_area())
|
||||
play_sfx("pick")
|
||||
|
||||
func drop_item():
|
||||
var item_to_drop = inventory.pop_item()
|
||||
planet.drop_item(item_to_drop, global_position)
|
||||
remove_action_area()
|
||||
play_sfx("pick")
|
||||
|
||||
func delete_item():
|
||||
inventory.set_item(null)
|
||||
remove_action_area()
|
||||
|
||||
func use_item():
|
||||
var item = inventory.get_item()
|
||||
var item : Item = inventory.get_item()
|
||||
var is_item_used = item.use(self)
|
||||
if is_item_used:
|
||||
energy -= 1
|
||||
if item.is_one_time_use():
|
||||
delete_item()
|
||||
|
||||
# Méthode déclenchée par la classe planet
|
||||
func _pass_day():
|
||||
energy = max_energy
|
||||
|
||||
func detect_closest_interactable():
|
||||
var in_range_interactables : Array[Interactable] = []
|
||||
@ -113,7 +129,7 @@ func detect_closest_interactable():
|
||||
|
||||
in_range_interactables.sort_custom(
|
||||
func(a : Node2D, b : Node2D) :
|
||||
return a.global_position.distance_to(global_position) > b.global_position.distance_to(global_position)
|
||||
return a.global_position.distance_to(global_position) < b.global_position.distance_to(global_position)
|
||||
)
|
||||
|
||||
if len(in_range_interactables) > 0:
|
||||
@ -134,16 +150,13 @@ func upgrade():
|
||||
energy += 1
|
||||
upgraded.emit()
|
||||
|
||||
func _process(_delta):
|
||||
get_input()
|
||||
move_and_slide()
|
||||
detect_closest_interactable()
|
||||
|
||||
func _on_root_gui_day_pass_pressed():
|
||||
controlling_player = false
|
||||
|
||||
func _on_root_gui_day_pass_finished():
|
||||
controlling_player = true
|
||||
|
||||
func _on_root_gui_game_click():
|
||||
try_use_item()
|
||||
func play_sfx(sound : String):
|
||||
match sound:
|
||||
"dig":
|
||||
$Audio/AudioStreamPlayer_dig.play()
|
||||
"harvest":
|
||||
$Audio/AudioStreamPlayer_harvest.play()
|
||||
"pick":
|
||||
$Audio/AudioStreamPlayer_pick_up.play()
|
||||
"move":
|
||||
$Audio/AudioStreamPlayer_movement.play()
|
||||
|
||||
27
entities/scripts/inspectable_entity.gd
Normal file
27
entities/scripts/inspectable_entity.gd
Normal file
@ -0,0 +1,27 @@
|
||||
extends Area2D
|
||||
class_name InspectableEntity
|
||||
|
||||
const MODULATE_INSPECTED_COLOR = Color.GRAY
|
||||
|
||||
@onready var default_modulate : Color = modulate
|
||||
@onready var mouse_signals_setuped : bool = setup_mouse_signals()
|
||||
|
||||
var inspected : bool = false :
|
||||
set(v):
|
||||
print(v)
|
||||
inspected = v
|
||||
modulate = MODULATE_INSPECTED_COLOR if inspected else default_modulate
|
||||
|
||||
func setup_mouse_signals() -> bool:
|
||||
mouse_entered.connect(_on_mouse_entered)
|
||||
mouse_exited.connect(_on_mouse_excited)
|
||||
return true
|
||||
|
||||
func _on_mouse_entered():
|
||||
Pointer.inspect_entity(self)
|
||||
|
||||
func _on_mouse_excited():
|
||||
Pointer.stop_inspect_entity(self)
|
||||
|
||||
func inspected_text():
|
||||
return ""
|
||||
1
entities/scripts/inspectable_entity.gd.uid
Normal file
1
entities/scripts/inspectable_entity.gd.uid
Normal file
@ -0,0 +1 @@
|
||||
uid://d3bk52402ylvl
|
||||
@ -1,7 +1,7 @@
|
||||
extends Area2D
|
||||
extends InspectableEntity
|
||||
class_name UndergroundLoot
|
||||
|
||||
const AREA_WIDTH = 10
|
||||
const AREA_WIDTH = 20
|
||||
const LOOTED_ITEM_RANDOM_RANGE = 100
|
||||
|
||||
const SPRITE_SCENE : PackedScene = preload("res://entities/underground_loot/underground_loot_sprite.tscn")
|
||||
@ -15,6 +15,9 @@ var planet : Planet # mis à jour par la classe Planet
|
||||
func _init(_planet = null):
|
||||
planet = _planet
|
||||
|
||||
func inspected_text():
|
||||
return "Buried Loot"
|
||||
|
||||
func generate_sprite() -> Node2D:
|
||||
var object = SPRITE_SCENE.instantiate()
|
||||
|
||||
|
||||
@ -257,6 +257,7 @@ grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
mouse_filter = 1
|
||||
script = ExtResource("1_udau0")
|
||||
|
||||
[node name="GameAction" type="TextureButton" parent="."]
|
||||
@ -266,6 +267,7 @@ anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
mouse_filter = 1
|
||||
|
||||
[node name="MarginContainer" type="MarginContainer" parent="."]
|
||||
layout_mode = 1
|
||||
@ -343,6 +345,7 @@ layout_mode = 2
|
||||
size_flags_horizontal = 8
|
||||
size_flags_vertical = 8
|
||||
focus_mode = 0
|
||||
mouse_filter = 1
|
||||
theme = ExtResource("2_nq5i2")
|
||||
text = "Recharge"
|
||||
icon = ExtResource("4_k4juk")
|
||||
@ -455,6 +458,7 @@ layout_mode = 2
|
||||
size_flags_horizontal = 8
|
||||
size_flags_vertical = 0
|
||||
focus_mode = 0
|
||||
mouse_filter = 1
|
||||
icon = ExtResource("9_2wykm")
|
||||
|
||||
[node name="RechargeFade" type="ColorRect" parent="."]
|
||||
|
||||
10
gui/game/mouse/scripts/mouse.gd
Normal file
10
gui/game/mouse/scripts/mouse.gd
Normal file
@ -0,0 +1,10 @@
|
||||
extends Control
|
||||
class_name Mouse
|
||||
|
||||
@export var default_cursor : Texture2D
|
||||
|
||||
func _ready():
|
||||
Input.set_custom_mouse_cursor(default_cursor)
|
||||
|
||||
func _process(_delta):
|
||||
position = get_viewport().get_mouse_position()
|
||||
1
gui/game/mouse/scripts/mouse.gd.uid
Normal file
1
gui/game/mouse/scripts/mouse.gd.uid
Normal file
@ -0,0 +1 @@
|
||||
uid://dm0d2sxki2ljd
|
||||
@ -2,13 +2,12 @@ extends Control
|
||||
|
||||
var pause = false :
|
||||
set(v):
|
||||
print(pause)
|
||||
pause = v
|
||||
visible = pause
|
||||
get_tree().paused = pause
|
||||
|
||||
func _ready():
|
||||
pause = false
|
||||
pause = true
|
||||
|
||||
func _input(_event):
|
||||
if Input.is_action_just_pressed("pause"):
|
||||
|
||||
@ -2,5 +2,8 @@ extends Node2D
|
||||
|
||||
@export_file var start_scene_path : String
|
||||
|
||||
func _ready():
|
||||
%Version.text = ProjectSettings.get_setting("application/config/version")
|
||||
|
||||
func _on_start_pressed():
|
||||
get_tree().change_scene_to_file(start_scene_path)
|
||||
|
||||
1
gui/pointer/assets/cursors/pointer.svg
Normal file
1
gui/pointer/assets/cursors/pointer.svg
Normal file
@ -0,0 +1 @@
|
||||
<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-pointer"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M3.039 4.277l3.904 13.563c.185 .837 .92 1.516 1.831 1.642l.17 .016a2.2 2.2 0 0 0 1.982 -1.006l.045 -.078l1.4 -2.072l4.05 4.05a2.067 2.067 0 0 0 2.924 0l1.047 -1.047c.388 -.388 .606 -.913 .606 -1.461l-.008 -.182a2.067 2.067 0 0 0 -.598 -1.28l-4.047 -4.048l2.103 -1.412c.726 -.385 1.18 -1.278 1.053 -2.189a2.2 2.2 0 0 0 -1.701 -1.845l-13.524 -3.89a1 1 0 0 0 -1.236 1.24z" /></svg>
|
||||
|
After Width: | Height: | Size: 607 B |
37
gui/pointer/assets/cursors/pointer.svg.import
Normal file
37
gui/pointer/assets/cursors/pointer.svg.import
Normal file
@ -0,0 +1,37 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://bspffyprdywgc"
|
||||
path="res://.godot/imported/pointer.svg-7e9852b8fc87e59d7ede00033ef3f170.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://gui/pointer/assets/cursors/pointer.svg"
|
||||
dest_files=["res://.godot/imported/pointer.svg-7e9852b8fc87e59d7ede00033ef3f170.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
|
||||
30
gui/pointer/pointer.tscn
Normal file
30
gui/pointer/pointer.tscn
Normal file
@ -0,0 +1,30 @@
|
||||
[gd_scene load_steps=3 format=3 uid="uid://0yr6b2jtuttm"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://vhumsfntpqcl" path="res://gui/pointer/scripts/pointer.gd" id="1_1pe2k"]
|
||||
[ext_resource type="Texture2D" uid="uid://bspffyprdywgc" path="res://gui/pointer/assets/cursors/pointer.svg" id="2_q4bvb"]
|
||||
|
||||
[node name="Pointer" type="Node"]
|
||||
process_mode = 3
|
||||
script = ExtResource("1_1pe2k")
|
||||
default_cursor = ExtResource("2_q4bvb")
|
||||
|
||||
[node name="CanvasLayer" type="CanvasLayer" parent="."]
|
||||
layer = 128
|
||||
|
||||
[node name="Inspector" type="Control" parent="CanvasLayer"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 3
|
||||
anchors_preset = 0
|
||||
offset_right = 40.0
|
||||
offset_bottom = 40.0
|
||||
size_flags_horizontal = 0
|
||||
size_flags_vertical = 0
|
||||
mouse_filter = 2
|
||||
|
||||
[node name="InspectorText" type="Label" parent="CanvasLayer/Inspector"]
|
||||
unique_name_in_owner = true
|
||||
z_index = 1
|
||||
layout_mode = 1
|
||||
offset_left = 26.0
|
||||
offset_right = 66.0
|
||||
offset_bottom = 23.0
|
||||
25
gui/pointer/scripts/pointer.gd
Normal file
25
gui/pointer/scripts/pointer.gd
Normal file
@ -0,0 +1,25 @@
|
||||
extends Node
|
||||
|
||||
@export var default_cursor : Texture2D
|
||||
|
||||
var inspected_entity : InspectableEntity = null
|
||||
|
||||
func _ready():
|
||||
Input.set_custom_mouse_cursor(default_cursor)
|
||||
|
||||
func _process(_delta):
|
||||
%Inspector.position = get_viewport().get_mouse_position()
|
||||
|
||||
func inspect_entity(entity : InspectableEntity):
|
||||
if inspected_entity and inspected_entity != entity:
|
||||
inspected_entity.inspected = false
|
||||
%InspectorText.text = entity.inspected_text()
|
||||
%InspectorText.visible = true
|
||||
inspected_entity = entity
|
||||
inspected_entity.inspected = true
|
||||
|
||||
func stop_inspect_entity(entity : InspectableEntity):
|
||||
entity.inspected = false
|
||||
if inspected_entity == entity:
|
||||
%InspectorText.visible = false
|
||||
inspected_entity = null
|
||||
1
gui/pointer/scripts/pointer.gd.uid
Normal file
1
gui/pointer/scripts/pointer.gd.uid
Normal file
@ -0,0 +1 @@
|
||||
uid://vhumsfntpqcl
|
||||
@ -19,6 +19,7 @@ config/icon="uid://df0y0s666ui4h"
|
||||
|
||||
[autoload]
|
||||
|
||||
Pointer="*res://gui/pointer/pointer.tscn"
|
||||
Music="*res://common/music/music.tscn"
|
||||
|
||||
[input]
|
||||
|
||||
11
root.tscn
11
root.tscn
@ -15,6 +15,7 @@ start_scene_path = "uid://d28cp7a21kwou"
|
||||
[node name="CanvasLayer" type="CanvasLayer" parent="."]
|
||||
|
||||
[node name="Background1" type="TextureRect" parent="CanvasLayer"]
|
||||
z_index = -1
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
@ -25,6 +26,7 @@ expand_mode = 2
|
||||
stretch_mode = 6
|
||||
|
||||
[node name="Background2" type="TextureRect" parent="CanvasLayer"]
|
||||
z_index = -1
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
@ -71,24 +73,25 @@ text = "Start"
|
||||
icon = ExtResource("7_qwhpj")
|
||||
|
||||
[node name="Version" type="Label" parent="CanvasLayer/MarginContainer"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 8
|
||||
size_flags_vertical = 0
|
||||
text = "Prototype 1"
|
||||
text = "Version"
|
||||
|
||||
[node name="Credits" type="Label" parent="CanvasLayer/MarginContainer"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 0
|
||||
size_flags_vertical = 8
|
||||
text = "🎨 Art
|
||||
text = "Art
|
||||
Céline Ferrand / Lunarde
|
||||
Camille Fleury
|
||||
|
||||
🖥️ Development / 🧩 Game Design
|
||||
Development / Game Design
|
||||
Zacharie Guet / Zink
|
||||
Victor Robert Jaunet / Altaezio
|
||||
|
||||
🎸 Music
|
||||
Music
|
||||
Niels / Nilou"
|
||||
|
||||
[connection signal="pressed" from="CanvasLayer/MarginContainer/Start" to="." method="_on_start_pressed"]
|
||||
|
||||
Loading…
Reference in New Issue
Block a user