système de sauvegarde, scène 3D de test sur la base astra et passage en forward+
This commit is contained in:
Binary file not shown.
|
After Width: | Height: | Size: 236 KiB |
@@ -0,0 +1,40 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://dlbdjyqj03gvo"
|
||||
path="res://.godot/imported/moss_talion_atlas_texture.png-7f77b023be9ac6fcea86176ee53d848b.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://stages/terrain/region/assets/textures/moss_biome/moss_talion_atlas_texture.png"
|
||||
dest_files=["res://.godot/imported/moss_talion_atlas_texture.png-7f77b023be9ac6fcea86176ee53d848b.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/uastc_level=0
|
||||
compress/rdo_quality_loss=0.0
|
||||
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/channel_remap/red=0
|
||||
process/channel_remap/green=1
|
||||
process/channel_remap/blue=2
|
||||
process/channel_remap/alpha=3
|
||||
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,4 +1,4 @@
|
||||
[gd_scene load_steps=9 format=3 uid="uid://tsi5j1uxppa4"]
|
||||
[gd_scene format=3 uid="uid://tsi5j1uxppa4"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://d1mp5sguc0b6u" path="res://stages/terrain/region/scripts/region.gd" id="1_441sk"]
|
||||
[ext_resource type="PackedScene" uid="uid://dt6mptqg80dew" path="res://gui/game/tutorial/tutorial.tscn" id="2_2f6js"]
|
||||
@@ -9,35 +9,34 @@
|
||||
[ext_resource type="PackedScene" uid="uid://d324mlmgls4fs" path="res://entities/interactables/truck/recharge/truck_recharge.tscn" id="7_6d8m3"]
|
||||
[ext_resource type="PackedScene" uid="uid://dj7gp3crtg2yt" path="res://entities/camera/camera.tscn" id="8_fwgig"]
|
||||
|
||||
[node name="Region" type="Node2D" node_paths=PackedStringArray("entity_container")]
|
||||
[node name="Region" type="Node2D" unique_id=1509166288 node_paths=PackedStringArray("entity_container")]
|
||||
script = ExtResource("1_441sk")
|
||||
first_loot_number = null
|
||||
loot_item_number = null
|
||||
entity_container = NodePath("Entities")
|
||||
|
||||
[node name="RegionGui" type="CanvasLayer" parent="."]
|
||||
[node name="PassDay" parent="." unique_id=1144772570 instance=ExtResource("3_ktnx3")]
|
||||
unique_name_in_owner = true
|
||||
visible = false
|
||||
|
||||
[node name="RegionGui" type="CanvasLayer" parent="." unique_id=2024485651]
|
||||
layer = 2
|
||||
|
||||
[node name="Tutorial" parent="RegionGui" node_paths=PackedStringArray("player", "region") instance=ExtResource("2_2f6js")]
|
||||
[node name="Tutorial" parent="RegionGui" unique_id=762436685 node_paths=PackedStringArray("player", "region") instance=ExtResource("2_2f6js")]
|
||||
player = NodePath("../../Entities/Player")
|
||||
region = NodePath("../..")
|
||||
|
||||
[node name="PassDay" parent="RegionGui" instance=ExtResource("3_ktnx3")]
|
||||
unique_name_in_owner = true
|
||||
[node name="GameGui" parent="." unique_id=1970837239 instance=ExtResource("4_qdnee")]
|
||||
|
||||
[node name="GameGui" parent="." instance=ExtResource("4_qdnee")]
|
||||
|
||||
[node name="Entities" type="Node2D" parent="."]
|
||||
[node name="Entities" type="Node2D" parent="." unique_id=2132324579]
|
||||
y_sort_enabled = true
|
||||
|
||||
[node name="TruckLadder" parent="Entities" instance=ExtResource("6_2w03p")]
|
||||
[node name="TruckLadder" parent="Entities" unique_id=1990299618 instance=ExtResource("6_2w03p")]
|
||||
position = Vector2(51, -112)
|
||||
|
||||
[node name="Player" parent="Entities" instance=ExtResource("5_ovqi1")]
|
||||
[node name="Player" parent="Entities" unique_id=75851644 instance=ExtResource("5_ovqi1")]
|
||||
z_index = 1
|
||||
|
||||
[node name="TruckRecharge" parent="Entities" instance=ExtResource("7_6d8m3")]
|
||||
[node name="TruckRecharge" parent="Entities" unique_id=2068738444 instance=ExtResource("7_6d8m3")]
|
||||
position = Vector2(-50, -124)
|
||||
|
||||
[node name="Camera" parent="." node_paths=PackedStringArray("following") instance=ExtResource("8_fwgig")]
|
||||
[node name="Camera" parent="." unique_id=1399042986 node_paths=PackedStringArray("following") instance=ExtResource("8_fwgig")]
|
||||
following = NodePath("../Entities/Player")
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
[gd_resource type="TileSet" load_steps=9 format=3 uid="uid://bqo32vh5etspf"]
|
||||
[gd_resource type="TileSet" format=3 uid="uid://bqo32vh5etspf"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://ch4rydip0nlt6" path="res://stages/terrain/region/assets/textures/moss_biome/moss_rock_atlas_texture.png" id="1_spfgy"]
|
||||
[ext_resource type="Texture2D" uid="uid://dr72xhc07i56e" path="res://stages/terrain/region/assets/textures/moss_biome/moss_contamination_atlas_texture.png" id="1_uqnql"]
|
||||
[ext_resource type="Texture2D" uid="uid://yl4dg6gerykb" path="res://stages/terrain/region/assets/textures/green_tiles.png" id="2_04qcq"]
|
||||
[ext_resource type="Texture2D" uid="uid://dlbdjyqj03gvo" path="res://stages/terrain/region/assets/textures/moss_biome/moss_talion_atlas_texture.png" id="2_fywqu"]
|
||||
[ext_resource type="Texture2D" uid="uid://bi08trir23od2" path="res://stages/terrain/region/assets/textures/red_rect.png" id="4_spfgy"]
|
||||
|
||||
[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_4i8c6"]
|
||||
@@ -404,7 +404,7 @@ texture_region_size = Vector2i(64, 64)
|
||||
|
||||
[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_spfgy"]
|
||||
resource_name = "Cristal"
|
||||
texture = ExtResource("2_04qcq")
|
||||
texture = ExtResource("2_fywqu")
|
||||
texture_region_size = Vector2i(64, 64)
|
||||
0:0/0 = 0
|
||||
0:0/0/terrain_set = 0
|
||||
@@ -675,17 +675,19 @@ texture_region_size = Vector2i(64, 64)
|
||||
9:1/0 = 0
|
||||
9:1/0/terrain_set = 0
|
||||
9:1/0/terrain = 2
|
||||
9:1/0/physics_layer_0/polygon_0/points = PackedVector2Array(32, -32, 32, 16, 16, 32, -32, 32, -32, -16, -16, -32)
|
||||
9:1/0/physics_layer_0/polygon_0/points = PackedVector2Array(-32, -32, 32, -32, 32, 32, -32, 32)
|
||||
9:1/0/terrains_peering_bit/right_side = 2
|
||||
9:1/0/terrains_peering_bit/bottom_right_corner = 2
|
||||
9:1/0/terrains_peering_bit/bottom_side = 2
|
||||
9:1/0/terrains_peering_bit/bottom_left_corner = 2
|
||||
9:1/0/terrains_peering_bit/left_side = 2
|
||||
9:1/0/terrains_peering_bit/top_left_corner = 2
|
||||
9:1/0/terrains_peering_bit/top_side = 2
|
||||
9:1/0/terrains_peering_bit/top_right_corner = 2
|
||||
9:2/0 = 0
|
||||
9:2/0/terrain_set = 0
|
||||
9:2/0/terrain = 2
|
||||
9:2/0/physics_layer_0/polygon_0/points = PackedVector2Array(32, -32, 32, 32, -32, 32, -32, -32)
|
||||
9:2/0/physics_layer_0/polygon_0/points = PackedVector2Array(-32, -32, 32, -32, 32, 32, -32, 32)
|
||||
9:2/0/terrains_peering_bit/right_side = 2
|
||||
9:2/0/terrains_peering_bit/bottom_right_corner = 2
|
||||
9:2/0/terrains_peering_bit/bottom_side = 2
|
||||
@@ -731,16 +733,28 @@ texture_region_size = Vector2i(64, 64)
|
||||
10:0/0/terrains_peering_bit/left_side = 2
|
||||
10:1/0 = 0
|
||||
10:1/0/terrain_set = 0
|
||||
10:1/0/terrain = 2
|
||||
10:1/0/physics_layer_0/polygon_0/points = PackedVector2Array(-32, -32, 32, -32, 32, 32, -32, 32)
|
||||
10:1/0/terrains_peering_bit/right_side = 2
|
||||
10:1/0/terrains_peering_bit/bottom_right_corner = 2
|
||||
10:1/0/terrains_peering_bit/bottom_side = 2
|
||||
10:1/0/terrains_peering_bit/bottom_left_corner = 2
|
||||
10:1/0/terrains_peering_bit/left_side = 2
|
||||
10:1/0/terrains_peering_bit/top_left_corner = 2
|
||||
10:1/0/terrains_peering_bit/top_side = 2
|
||||
10:1/0/terrains_peering_bit/top_right_corner = 2
|
||||
10:2/0 = 0
|
||||
10:2/0/terrain_set = 0
|
||||
10:2/0/terrain = 2
|
||||
10:2/0/physics_layer_0/polygon_0/points = PackedVector2Array(32, -16, 32, 32, -16, 32, -32, 16, -32, -32, 16, -32)
|
||||
10:2/0/physics_layer_0/polygon_0/points = PackedVector2Array(-32, -32, 32, -32, 32, 32, -32, 32)
|
||||
10:2/0/terrains_peering_bit/right_side = 2
|
||||
10:2/0/terrains_peering_bit/bottom_right_corner = 2
|
||||
10:2/0/terrains_peering_bit/bottom_side = 2
|
||||
10:2/0/terrains_peering_bit/bottom_left_corner = 2
|
||||
10:2/0/terrains_peering_bit/left_side = 2
|
||||
10:2/0/terrains_peering_bit/top_left_corner = 2
|
||||
10:2/0/terrains_peering_bit/top_side = 2
|
||||
10:2/0/terrains_peering_bit/top_right_corner = 2
|
||||
10:3/0 = 0
|
||||
10:3/0/terrain_set = 0
|
||||
10:3/0/terrain = 2
|
||||
|
||||
@@ -8,7 +8,7 @@ enum TileDiff { NO_DIFF,PRESENT,ABSENT }
|
||||
@export var decontamination_tiles_diff : Dictionary[String, TileDiff]
|
||||
|
||||
func _init(
|
||||
_chunk_coord : Vector2i
|
||||
_chunk_coord : Vector2i = Vector2i.ZERO
|
||||
):
|
||||
chunk_coord = _chunk_coord
|
||||
|
||||
|
||||
@@ -47,7 +47,7 @@ func _ready():
|
||||
|
||||
for e in entity_container.get_children():
|
||||
if e is Plant:
|
||||
data.add_plant_data(e.data)
|
||||
data.add_plant_data(e.data, false)
|
||||
|
||||
generate_first_entities()
|
||||
|
||||
@@ -58,6 +58,8 @@ func _ready():
|
||||
decontamination_layer = DecontaminationLayer.new(self)
|
||||
add_child(decontamination_layer)
|
||||
|
||||
player.global_position = data.player_position
|
||||
|
||||
generate_near_chunks(player)
|
||||
|
||||
edit_map_origin()
|
||||
@@ -154,6 +156,8 @@ func get_chunk_generation_count() -> int:
|
||||
|
||||
func save():
|
||||
data.entities_saved_data = save_entities()
|
||||
data.player_position = player.global_position
|
||||
GameInfo.save_game_data()
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -191,6 +195,5 @@ func pass_day():
|
||||
e._end_pass_day()
|
||||
|
||||
data.end_pass_day()
|
||||
|
||||
save()
|
||||
#endregion
|
||||
|
||||
@@ -22,16 +22,23 @@ const DEFAULT_OBJECTIVE := 10
|
||||
@export var tutorial_step : int = 0
|
||||
@export var tutorial = false
|
||||
|
||||
@export var state : State = State.IN_PROGRESS :
|
||||
set(v):
|
||||
print("Set state to %d" % v)
|
||||
state = v
|
||||
|
||||
@export var chunks_data : Dictionary[String, ChunkData]
|
||||
|
||||
@export var player_position : Vector2i = Region.CHUNK_SIZE/2. * Vector2.ONE
|
||||
|
||||
@export var charges : int :
|
||||
set(v):
|
||||
charges = v
|
||||
updated.emit(self)
|
||||
update()
|
||||
@export var objective : int :
|
||||
set(v):
|
||||
objective = v
|
||||
updated.emit(self)
|
||||
update()
|
||||
|
||||
|
||||
var in_passing_day_animation := false
|
||||
@@ -46,6 +53,14 @@ func _init(
|
||||
|
||||
tutorial = parameter.tutorial
|
||||
|
||||
func update():
|
||||
print("Score %d > Objective %d" % [get_score(), objective] )
|
||||
if objective > 0 and get_score() >= objective:
|
||||
state = State.SUCCEEDED
|
||||
if state != State.SUCCEEDED and charges == 0:
|
||||
state = State.FAILED
|
||||
updated.emit(self)
|
||||
|
||||
#region ------------------ Chunks ------------------
|
||||
|
||||
func get_coord_id(coord):
|
||||
@@ -82,12 +97,7 @@ func is_objective_reached():
|
||||
return get_score() >= objective
|
||||
|
||||
func get_state() -> State:
|
||||
if get_score() >= objective:
|
||||
return State.SUCCEEDED
|
||||
elif charges <= 0:
|
||||
return State.FAILED
|
||||
else:
|
||||
return State.IN_PROGRESS
|
||||
return state
|
||||
#endregion
|
||||
|
||||
#region ------------------ Day ------------------
|
||||
@@ -107,10 +117,12 @@ func end_pass_day():
|
||||
|
||||
#region ------------------ Plants ------------------
|
||||
|
||||
func add_plant_data(plant_data : PlantData):
|
||||
score_by_plant[plant_data] = plant_data.get_score()
|
||||
func add_plant_data(plant_data : PlantData, with_update = true):
|
||||
score_by_plant[plant_data] = 0
|
||||
plant_data.disappeared.connect(_on_plant_disappeared)
|
||||
plant_data.updated.connect(_on_plant_updated)
|
||||
if with_update:
|
||||
_on_plant_updated(plant_data)
|
||||
|
||||
func _on_plant_updated(plant_data : PlantData):
|
||||
var old_plant_score = score_by_plant[plant_data]
|
||||
@@ -118,11 +130,11 @@ func _on_plant_updated(plant_data : PlantData):
|
||||
|
||||
if old_plant_score != score_by_plant[plant_data]:
|
||||
plant_changing_score.emit(plant_data, score_by_plant[plant_data] - old_plant_score)
|
||||
updated.emit(self)
|
||||
update()
|
||||
|
||||
func _on_plant_disappeared(plant_data : PlantData):
|
||||
plant_changing_score.emit(plant_data, - score_by_plant[plant_data])
|
||||
score_by_plant.erase(plant_data)
|
||||
updated.emit(self)
|
||||
update()
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -10,7 +10,7 @@ class_name RegionParameter
|
||||
func _init(
|
||||
_charges : int = 10,
|
||||
_objective : int = 10,
|
||||
_name = Random.generate_random_name(),
|
||||
_name = Random.generate_random_word(),
|
||||
_tutorial = false,
|
||||
_region_seed = randi(),
|
||||
):
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
extends RegionLayer
|
||||
class_name RockLayer
|
||||
|
||||
const MATERIAL : Material = preload("res://stages/terrain/region/resources/materials/rock_planet_tilemap.tres")
|
||||
const ROCK_TILE_TERRAIN_SET : int = 0
|
||||
const ROCK_TILE_TERRAIN : int = 1
|
||||
const CRISTAL_TILE_TERRAIN : int = 2
|
||||
@@ -12,7 +11,6 @@ const CRISTAL_LOOT_CHANCE : float = 1
|
||||
enum TileType { EMPTY,ROCK,CRISTAL }
|
||||
|
||||
func setup():
|
||||
material = MATERIAL
|
||||
z_index = 2
|
||||
|
||||
func place_rocks(coords : Array[Vector2i], type := TileType.ROCK,on_finished : Callable = (func(): pass)):
|
||||
|
||||
@@ -34,6 +34,7 @@ func enroll_entity(entity : Node2D):
|
||||
if entity is Player:
|
||||
player = entity
|
||||
|
||||
|
||||
func save_entities() -> Array[EntityData]:
|
||||
var saved_entities_data : Array[EntityData] = []
|
||||
for e in entity_container.get_children():
|
||||
|
||||
Reference in New Issue
Block a user