Dev Démo 1.2
* les plantes se placent désormais sur une grille * ajouts de curseurs relatifs à l'item * ajout de settings sur la sensibilité à la souris * ajout d'un défi en fin de run
This commit is contained in:
@@ -6,6 +6,7 @@ const SHIP_ICON = preload("res://common/icons/rocket.svg")
|
||||
const START_ICON = preload("res://common/icons/device-floppy.svg")
|
||||
const REGION_ICON = preload("res://common/icons/globe.svg")
|
||||
const DESTINATION_ICON = preload("res://common/icons/flag-2.svg")
|
||||
const DANGER_ICON = preload("res://common/icons/alert-triangle.svg")
|
||||
|
||||
const PREVIOUS_COLOR = Color("2364AAAA")
|
||||
const CURRENT_COLOR = Color("e29f32")
|
||||
@@ -54,6 +55,9 @@ func update(with_animation := true):
|
||||
for m_i in range(len(modifiers)):
|
||||
spawn_icon(modifiers[m_i].get_icon(), Vector2(i,-m_i - 1),color, 0.7)
|
||||
|
||||
if story_step.is_run_point_dangerous(i):
|
||||
spawn_icon(DANGER_ICON, Vector2(i,-len(modifiers) - 1),color, 0.7)
|
||||
|
||||
spawn_icon(icon, Vector2(i,0),color)
|
||||
|
||||
ship_icon = spawn_icon(SHIP_ICON, Vector2(current_position, 1), CURRENT_COLOR, 1)
|
||||
|
||||
@@ -21,9 +21,9 @@
|
||||
[sub_resource type="Resource" id="Resource_r4e5h"]
|
||||
script = ExtResource("3_r4e5h")
|
||||
rain_value = 0.42404523
|
||||
cloud_value = 0.20464431
|
||||
wind_direction = Vector2(0.4359836, 0.8999546)
|
||||
wind_force = 0.9393943
|
||||
cloud_value = 0.4445428
|
||||
wind_direction = Vector2(-0.63176113, -0.7751632)
|
||||
wind_force = 0.92673165
|
||||
fog_value = 0.5362279
|
||||
ambiance_name = "ExteriorWindy"
|
||||
type = 3
|
||||
@@ -190,7 +190,8 @@ layer = 3
|
||||
[node name="Entities" type="Node2D" parent="." unique_id=2132324579]
|
||||
y_sort_enabled = true
|
||||
|
||||
[node name="Player" parent="Entities" unique_id=75851644 instance=ExtResource("5_ovqi1")]
|
||||
[node name="Player" parent="Entities" unique_id=75851644 node_paths=PackedStringArray("region") instance=ExtResource("5_ovqi1")]
|
||||
region = NodePath("../..")
|
||||
|
||||
[node name="RechargeStation" parent="Entities" unique_id=2068738444 instance=ExtResource("7_6d8m3")]
|
||||
unique_name_in_owner = true
|
||||
|
||||
73
stages/terrain/region/scripts/plant_grid.gd
Normal file
73
stages/terrain/region/scripts/plant_grid.gd
Normal file
@@ -0,0 +1,73 @@
|
||||
extends Sprite2D
|
||||
class_name PlantGrid
|
||||
|
||||
const GRID_SHIFT : int = roundi(Region.TILE_SIZE / 2.)
|
||||
const GRID_SIZE : int = Region.TILE_SIZE
|
||||
const POINT_RADIUS : int = 5
|
||||
const POINT_COLOR : Color = Color.WHITE
|
||||
const POINT_RANDOM_SHIFT = roundi(Region.TILE_SIZE / 2.)
|
||||
|
||||
const REFRESH_TIME : float = 2.
|
||||
|
||||
var refresh_timer : float = 0.
|
||||
|
||||
var region : Region
|
||||
var noise : Noise
|
||||
|
||||
func _init(
|
||||
_region : Region
|
||||
):
|
||||
region = _region
|
||||
noise = FastNoiseLite.new()
|
||||
noise.seed = region.data.region_seed
|
||||
noise.noise_type = noise.TYPE_VALUE
|
||||
|
||||
|
||||
func _process(delta):
|
||||
refresh_timer += delta
|
||||
if refresh_timer > REFRESH_TIME:
|
||||
refresh_timer = 0
|
||||
queue_redraw()
|
||||
var current_item = GameInfo.game_data.player_data.inventory.get_item()
|
||||
var target_opacity = (1.) if current_item and current_item.snap_usage_to_grid() else 0.
|
||||
|
||||
modulate.a = lerp(
|
||||
modulate.a,
|
||||
target_opacity,
|
||||
0.1)
|
||||
|
||||
func _draw():
|
||||
for p in get_grid_point():
|
||||
draw_point(p)
|
||||
|
||||
|
||||
func get_grid_point() -> Array[Vector2]:
|
||||
var grid_points : Array[Vector2] = []
|
||||
|
||||
for x in range(-Region.CHUNK_TILE_SIZE, Region.CHUNK_TILE_SIZE * 2):
|
||||
for y in range(-Region.CHUNK_TILE_SIZE, Region.CHUNK_TILE_SIZE * 2):
|
||||
if (
|
||||
region.is_coords_decontaminated([Vector2(x,y)])
|
||||
and not region.is_coords_rocky([Vector2(x,y)])
|
||||
):
|
||||
grid_points.append(
|
||||
get_point_for_tile(Vector2(x,y))
|
||||
)
|
||||
return grid_points
|
||||
|
||||
func get_point_for_tile(tile_pos: Vector2):
|
||||
return get_world_pos_for_tile(tile_pos) + get_random_shift(tile_pos)
|
||||
|
||||
func get_world_pos_for_tile(tile_pos: Vector2):
|
||||
return tile_pos*GRID_SIZE + Vector2.ONE * GRID_SHIFT
|
||||
|
||||
func get_random_shift(pos: Vector2):
|
||||
return Vector2.RIGHT.rotated(noise.get_noise_2d(pos.x*100,pos.y*100) * 2*PI) * POINT_RANDOM_SHIFT * noise.get_noise_2d(pos.x*50,pos.y*50)
|
||||
|
||||
|
||||
func draw_point(pos: Vector2):
|
||||
draw_circle(
|
||||
pos,
|
||||
POINT_RADIUS,
|
||||
POINT_COLOR
|
||||
)
|
||||
1
stages/terrain/region/scripts/plant_grid.gd.uid
Normal file
1
stages/terrain/region/scripts/plant_grid.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://c8l37exf4csv7
|
||||
@@ -45,6 +45,7 @@ var data_last_updated = 0.
|
||||
|
||||
@onready var recharge_station : TruckRecharge = %RechargeStation
|
||||
@onready var camera : RegionCamera = %Camera
|
||||
var plant_grid : PlantGrid
|
||||
|
||||
# Cheat Code
|
||||
# func _input(_e):
|
||||
@@ -99,7 +100,9 @@ func _ready():
|
||||
GameInfo.game_data.player_data.inventory.add_item(Pickaxe.new())
|
||||
GameInfo.game_data.player_data.inventory.add_item(Fork.new())
|
||||
GameInfo.game_data.player_data.inventory.add_item(ShipPortal.new())
|
||||
|
||||
|
||||
plant_grid = PlantGrid.new(self)
|
||||
add_child(plant_grid)
|
||||
|
||||
data.succeded.connect(finishing_region_animation)
|
||||
|
||||
@@ -310,6 +313,8 @@ func is_coords_decontaminated(tiles_coords : Array[Vector2i]):
|
||||
var local_coord := TilesDiffData.get_local_coord(coord, chunk.chunk_coord)
|
||||
if not chunk.decontamination_layer.is_decontamined(local_coord):
|
||||
return false
|
||||
else:
|
||||
return false
|
||||
return true
|
||||
|
||||
func is_coords_rocky(tiles_coords : Array[Vector2i]):
|
||||
@@ -317,7 +322,9 @@ func is_coords_rocky(tiles_coords : Array[Vector2i]):
|
||||
var chunk : Chunk = get_chunk_for_coord(coord)
|
||||
if chunk:
|
||||
var local_coord := TilesDiffData.get_local_coord(coord, chunk.chunk_coord)
|
||||
if chunk.rock_layer.get_tile_type(local_coord) == RockLayer.TileType.ROCK:
|
||||
if (
|
||||
chunk.rock_layer.get_tile_type(local_coord) == RockLayer.TileType.ROCK
|
||||
or chunk.rock_layer.get_tile_type(local_coord) == RockLayer.TileType.CRISTAL):
|
||||
return true
|
||||
return false
|
||||
|
||||
|
||||
@@ -2,8 +2,8 @@ extends Resource
|
||||
class_name RegionParameter
|
||||
|
||||
const DEFAULT_ROCK_THRESHOLD = 0.3
|
||||
const DEFAULT_DECONTAMINATION_THRESHOLD = 0.35
|
||||
const DEFAULT_CRISTAL_THRESHOLD = 0.1
|
||||
const DEFAULT_DECONTAMINATION_THRESHOLD = 0.1
|
||||
const DEFAULT_CRISTAL_THRESHOLD = 0.3
|
||||
const DEFAULT_CHARGE = 10
|
||||
const DEFAULT_TALION_CELL_CHANCE : Array[int] = [0,0,0,1,1]
|
||||
const DEFAULT_ENERGY_CELL_CHANCE : Array[int] = [1,2,2,2,3]
|
||||
|
||||
@@ -452,7 +452,6 @@ size = Vector2i(1980, 1080)
|
||||
|
||||
[node name="Planet3d" parent="SubViewport" unique_id=926789923 instance=ExtResource("5_7a1qq")]
|
||||
unique_name_in_owner = true
|
||||
details = 20
|
||||
noise = SubResource("FastNoiseLite_lwj2x")
|
||||
|
||||
[node name="Camera3D" type="Camera3D" parent="SubViewport" unique_id=806252928]
|
||||
|
||||
Reference in New Issue
Block a user