Minor improvements

This commit is contained in:
Zacharie Guet 2024-09-01 12:41:08 +02:00
parent 0d37e456cb
commit 21b694d4b6
9 changed files with 83 additions and 34 deletions

1
.gitignore vendored
View File

@ -3,3 +3,4 @@
/android/
addons/
*.tmp
export/

View File

@ -1,13 +1,11 @@
[gd_scene load_steps=6 format=3 uid="uid://d3srnfkpx01we"]
[gd_scene load_steps=5 format=3 uid="uid://d3srnfkpx01we"]
[ext_resource type="PackedScene" uid="uid://d3hul8b7hlmj7" path="res://scenes/Map.tscn" id="1_nnb57"]
[ext_resource type="Script" path="res://scripts/game.gd" id="1_ult6o"]
[ext_resource type="PackedScene" uid="uid://dha8pa1les53a" path="res://scenes/Gui.tscn" id="2_d5c8m"]
[ext_resource type="Script" path="res://scripts/camera.gd" id="3_7olyu"]
[ext_resource type="PackedScene" uid="uid://qpdlnll5pihe" path="res://objects/Planter.tscn" id="3_qx0o7"]
[node name="Game" type="Node2D"]
script = ExtResource("1_ult6o")
[node name="Map" parent="." instance=ExtResource("1_nnb57")]

64
export_presets.cfg Normal file
View File

@ -0,0 +1,64 @@
[preset.0]
name="Minijam 166"
platform="Windows Desktop"
runnable=true
advanced_options=false
dedicated_server=false
custom_features=""
export_filter="all_resources"
include_filter=""
exclude_filter=""
export_path="export/windows/MiniJam166.exe"
encryption_include_filters=""
encryption_exclude_filters=""
encrypt_pck=false
encrypt_directory=false
script_export_mode=2
[preset.0.options]
custom_template/debug=""
custom_template/release=""
debug/export_console_wrapper=1
binary_format/embed_pck=false
texture_format/s3tc_bptc=true
texture_format/etc2_astc=false
binary_format/architecture="x86_64"
codesign/enable=false
codesign/timestamp=true
codesign/timestamp_server_url=""
codesign/digest_algorithm=1
codesign/description=""
codesign/custom_options=PackedStringArray()
application/modify_resources=true
application/icon=""
application/console_wrapper_icon=""
application/icon_interpolation=4
application/file_version=""
application/product_version=""
application/company_name=""
application/product_name=""
application/file_description=""
application/copyright=""
application/trademarks=""
application/export_angle=0
application/export_d3d12=0
application/d3d12_agility_sdk_multiarch=true
ssh_remote_deploy/enabled=false
ssh_remote_deploy/host="user@host_ip"
ssh_remote_deploy/port="22"
ssh_remote_deploy/extra_args_ssh=""
ssh_remote_deploy/extra_args_scp=""
ssh_remote_deploy/run_script="Expand-Archive -LiteralPath '{temp_dir}\\{archive_name}' -DestinationPath '{temp_dir}'
$action = New-ScheduledTaskAction -Execute '{temp_dir}\\{exe_name}' -Argument '{cmd_args}'
$trigger = New-ScheduledTaskTrigger -Once -At 00:00
$settings = New-ScheduledTaskSettingsSet
$task = New-ScheduledTask -Action $action -Trigger $trigger -Settings $settings
Register-ScheduledTask godot_remote_debug -InputObject $task -Force:$true
Start-ScheduledTask -TaskName godot_remote_debug
while (Get-ScheduledTask -TaskName godot_remote_debug | ? State -eq running) { Start-Sleep -Milliseconds 100 }
Unregister-ScheduledTask -TaskName godot_remote_debug -Confirm:$false -ErrorAction:SilentlyContinue"
ssh_remote_deploy/cleanup_script="Stop-ScheduledTask -TaskName godot_remote_debug -ErrorAction:SilentlyContinue
Unregister-ScheduledTask -TaskName godot_remote_debug -Confirm:$false -ErrorAction:SilentlyContinue
Remove-Item -Recurse -Force '{temp_dir}'"

View File

@ -3,7 +3,7 @@
[ext_resource type="Script" path="res://scripts/map.gd" id="1_3np0o"]
[ext_resource type="PackedScene" uid="uid://6ferubyu2uy1" path="res://scenes/Scanners.tscn" id="1_6mlj0"]
[ext_resource type="Texture2D" uid="uid://dtvde6oxrfuk1" path="res://assets/texture/ground.jpg" id="3_20ci8"]
[ext_resource type="PackedScene" uid="uid://cj457q2fx5mim" path="res://objects/Animal.tscn" id="4_pkphc"]
[ext_resource type="PackedScene" path="res://objects/Animal.tscn" id="4_pkphc"]
[node name="Map" type="Node2D"]
script = ExtResource("1_3np0o")

View File

@ -1,12 +1 @@
extends Node2D
@onready var gui: Gui = $Interface/Gui
@onready var planter: Planter = $Planter
func _ready() -> void:
pass # Replace with function body.
func _on_planter_seed_list_updated() -> void:
pass # Replace with function body.

View File

@ -15,11 +15,11 @@ func set_area(need : Array):
zone_grad.set_color(0, Color.BLACK)
zone_grad.set_color(1, Color.BLACK)
var min = (float(need[0]) + GameTerrain.LEVELS_NUMBER/2)/GameTerrain.LEVELS_NUMBER
var max = (float(need[1]) + GameTerrain.LEVELS_NUMBER/2)/GameTerrain.LEVELS_NUMBER
var min_value = (float(need[0]) + float(GameTerrain.LEVELS_NUMBER)/2)/GameTerrain.LEVELS_NUMBER
var max_value = (float(need[1]) + float(GameTerrain.LEVELS_NUMBER)/2)/GameTerrain.LEVELS_NUMBER
zone_grad.add_point(min, Color(0,0,0,0))
zone_grad.add_point(max, Color.BLACK)
zone_grad.add_point(min_value, Color(0,0,0,0))
zone_grad.add_point(max_value, Color.BLACK)
var texture := GradientTexture1D.new()

View File

@ -44,7 +44,7 @@ func check_terrain_viability() -> bool:
return false
var presence := GameTerrain.get_stat(position, GameTerrain.Stats.PRESENCE)
presence += GameTerrain.LEVELS_NUMBER / 2
presence += float(GameTerrain.LEVELS_NUMBER) / 2
if presence < parameter.presence_need[0] or presence > parameter.presence_need[1]:
return false

View File

@ -27,7 +27,7 @@ func _ready() -> void:
seed_queue.push_front(randi_range(0, plants.size() - 1))
seed_list_updated.emit()
func _process(delta: float) -> void:
func _process(_delta: float) -> void:
var space := get_world_2d().direct_space_state
var parameters = PhysicsPointQueryParameters2D.new()
parameters.position = camera.get_global_mouse_position()

View File

@ -16,26 +16,24 @@ const MAP_RATIO = 8;
var sum := 0.0
signal terrain_updated
func _ready():
setup_texture(Vector3i(0, 0, -5))
func map_to_pixel(
position : Vector2
pos : Vector2
) -> Vector2i :
return Vector2i(
int(position.x / MAP_RATIO),
int(position.y / MAP_RATIO)
int(pos.x / MAP_RATIO),
int(pos.y / MAP_RATIO)
)
func is_on_map(position: Vector2) -> bool:
return position.x >= 0 and position.x <= TERRAIN_SIZE.x * MAP_RATIO and position.y >= 0 and position.y <= TERRAIN_SIZE.y * MAP_RATIO
func is_on_map(pos: Vector2) -> bool:
return pos.x >= 0 and pos.x <= TERRAIN_SIZE.x * MAP_RATIO and pos.y >= 0 and pos.y <= TERRAIN_SIZE.y * MAP_RATIO
func color_value_to_level(
color_value : float
) -> int:
return roundi(color_value*LEVELS_NUMBER) - LEVELS_NUMBER/2
return roundi(color_value*LEVELS_NUMBER) - float(LEVELS_NUMBER)/2
func color_to_levels(
color: Color
@ -52,11 +50,11 @@ func level_to_color_value(
var limited_level = max(
min(
level,
LEVELS_NUMBER/2
float(LEVELS_NUMBER)/2
),
-LEVELS_NUMBER/2
-float(LEVELS_NUMBER)/2
)
return float(limited_level+LEVELS_NUMBER/2)/LEVELS_NUMBER
return float(limited_level+float(LEVELS_NUMBER)/2)/LEVELS_NUMBER
func levels_to_color(
levels: Vector3i
@ -159,7 +157,6 @@ func setup_texture(
update_texture()
func update_texture():
emit_signal("terrain_updated")
texture.update(image)
func get_texture():