BIN
assets/SpaceMono-Bold.ttf
Normal file
BIN
assets/SpaceMono-Bold.ttf
Normal file
Binary file not shown.
BIN
assets/SpaceMono-BoldItalic.ttf
Normal file
BIN
assets/SpaceMono-BoldItalic.ttf
Normal file
Binary file not shown.
BIN
assets/SpaceMono-Italic.ttf
Normal file
BIN
assets/SpaceMono-Italic.ttf
Normal file
Binary file not shown.
BIN
assets/SpaceMono-Regular.ttf
Normal file
BIN
assets/SpaceMono-Regular.ttf
Normal file
Binary file not shown.
33
assets/SpaceMono-Regular.ttf.import
Normal file
33
assets/SpaceMono-Regular.ttf.import
Normal file
@@ -0,0 +1,33 @@
|
||||
[remap]
|
||||
|
||||
importer="font_data_dynamic"
|
||||
type="FontFile"
|
||||
uid="uid://cuhtrlqg4s5tw"
|
||||
path="res://.godot/imported/SpaceMono-Regular.ttf-a0e59f506ad76f27d9c5d7797291715d.fontdata"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://assets/SpaceMono-Regular.ttf"
|
||||
dest_files=["res://.godot/imported/SpaceMono-Regular.ttf-a0e59f506ad76f27d9c5d7797291715d.fontdata"]
|
||||
|
||||
[params]
|
||||
|
||||
Rendering=null
|
||||
antialiasing=1
|
||||
generate_mipmaps=false
|
||||
multichannel_signed_distance_field=false
|
||||
msdf_pixel_range=8
|
||||
msdf_size=48
|
||||
allow_system_fallback=true
|
||||
force_autohinter=false
|
||||
hinting=1
|
||||
subpixel_positioning=1
|
||||
oversampling=0.0
|
||||
Fallbacks=null
|
||||
fallbacks=[]
|
||||
Compress=null
|
||||
compress=true
|
||||
preload=[]
|
||||
language_support={}
|
||||
script_support={}
|
||||
opentype_features={}
|
||||
6
data/world_theme.tres
Normal file
6
data/world_theme.tres
Normal file
@@ -0,0 +1,6 @@
|
||||
[gd_resource type="Theme" load_steps=2 format=3 uid="uid://dcpugcgqnnf17"]
|
||||
|
||||
[ext_resource type="FontFile" uid="uid://cuhtrlqg4s5tw" path="res://assets/SpaceMono-Regular.ttf" id="1_suqxc"]
|
||||
|
||||
[resource]
|
||||
Label/fonts/font = ExtResource("1_suqxc")
|
||||
@@ -10,7 +10,11 @@ config_version=5
|
||||
|
||||
[application]
|
||||
|
||||
config/name="Corupture"
|
||||
config/name="Corrupture"
|
||||
run/main_scene="res://scene/world.tscn"
|
||||
config/features=PackedStringArray("4.2", "Forward Plus")
|
||||
config/icon="res://icon.svg"
|
||||
|
||||
[gui]
|
||||
|
||||
theme/custom="res://data/world_theme.tres"
|
||||
|
||||
@@ -1,15 +1,24 @@
|
||||
[gd_scene load_steps=7 format=3 uid="uid://m0us5xqa3gnk"]
|
||||
[gd_scene load_steps=10 format=3 uid="uid://m0us5xqa3gnk"]
|
||||
|
||||
[ext_resource type="Script" path="res://scripts/world.gd" id="1_yf6q1"]
|
||||
[ext_resource type="TileSet" uid="uid://d1sh6dy2w10b0" path="res://data/scifi_tileset.tres" id="2_sa7dm"]
|
||||
[ext_resource type="Script" path="res://scripts/Window.gd" id="3_bfjot"]
|
||||
[ext_resource type="Script" path="res://scripts/BuildingManager.gd" id="4_61js3"]
|
||||
[ext_resource type="Texture2D" uid="uid://n806c03hgaq1" path="res://assets/scifi_tilesheet@2.png" id="5_qhth7"]
|
||||
|
||||
[sub_resource type="FastNoiseLite" id="FastNoiseLite_teaou"]
|
||||
|
||||
[sub_resource type="NoiseTexture2D" id="NoiseTexture2D_8pjar"]
|
||||
noise = SubResource("FastNoiseLite_teaou")
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_m3qlj"]
|
||||
atlas = ExtResource("5_qhth7")
|
||||
region = Rect2(640, 768, 128, 128)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_oqxqp"]
|
||||
atlas = ExtResource("5_qhth7")
|
||||
region = Rect2(640, 384, 128, 128)
|
||||
|
||||
[node name="world" type="Node2D"]
|
||||
script = ExtResource("1_yf6q1")
|
||||
noise_texture = SubResource("NoiseTexture2D_8pjar")
|
||||
@@ -18,12 +27,14 @@ noise_texture = SubResource("NoiseTexture2D_8pjar")
|
||||
tile_set = ExtResource("2_sa7dm")
|
||||
format = 2
|
||||
layer_0/name = "ground"
|
||||
layer_1/name = "Cursor"
|
||||
layer_1/name = "corruption"
|
||||
layer_1/tile_data = PackedInt32Array()
|
||||
layer_2/name = "environment"
|
||||
layer_2/name = "cursor"
|
||||
layer_2/tile_data = PackedInt32Array()
|
||||
layer_3/name = "buildings"
|
||||
layer_3/name = "environment"
|
||||
layer_3/tile_data = PackedInt32Array()
|
||||
layer_4/name = "buildings"
|
||||
layer_4/tile_data = PackedInt32Array()
|
||||
|
||||
[node name="Camera2D" type="Camera2D" parent="."]
|
||||
zoom = Vector2(0.3, 0.3)
|
||||
@@ -33,3 +44,45 @@ script = ExtResource("3_bfjot")
|
||||
|
||||
[node name="BuildingManager" type="Node2D" parent="."]
|
||||
script = ExtResource("4_61js3")
|
||||
|
||||
[node name="CanvasLayer" type="CanvasLayer" parent="."]
|
||||
|
||||
[node name="GUI" type="Control" parent="CanvasLayer"]
|
||||
layout_mode = 3
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
mouse_filter = 1
|
||||
|
||||
[node name="ResourceContainer" type="PanelContainer" parent="CanvasLayer/GUI"]
|
||||
layout_mode = 1
|
||||
anchors_preset = 1
|
||||
anchor_left = 1.0
|
||||
anchor_right = 1.0
|
||||
offset_left = -128.0
|
||||
offset_bottom = 128.0
|
||||
grow_horizontal = 0
|
||||
|
||||
[node name="GridContainer" type="GridContainer" parent="CanvasLayer/GUI/ResourceContainer"]
|
||||
layout_mode = 2
|
||||
columns = 2
|
||||
|
||||
[node name="GemTexture" type="TextureRect" parent="CanvasLayer/GUI/ResourceContainer/GridContainer"]
|
||||
layout_mode = 2
|
||||
texture = SubResource("AtlasTexture_m3qlj")
|
||||
expand_mode = 3
|
||||
|
||||
[node name="GemLabel" type="Label" parent="CanvasLayer/GUI/ResourceContainer/GridContainer"]
|
||||
layout_mode = 2
|
||||
text = "100000"
|
||||
|
||||
[node name="CarbonTexture" type="TextureRect" parent="CanvasLayer/GUI/ResourceContainer/GridContainer"]
|
||||
layout_mode = 2
|
||||
texture = SubResource("AtlasTexture_oqxqp")
|
||||
expand_mode = 3
|
||||
|
||||
[node name="CarbonLabel" type="Label" parent="CanvasLayer/GUI/ResourceContainer/GridContainer"]
|
||||
layout_mode = 2
|
||||
text = "100"
|
||||
|
||||
@@ -19,5 +19,5 @@ func _on_expand_timer_timeout():
|
||||
while corruption_tiles.has(corrupt_tile):
|
||||
corrupt_tile = corruption_tiles.pick_random() + self.curruption_directions.pick_random()
|
||||
corruption_tiles.append(corrupt_tile)
|
||||
world_grid.set_cells_terrain_connect(Constants.TilemapLayers.ENVIRONMENT, corruption_tiles, 0, 0)
|
||||
world_grid.set_cells_terrain_connect(Constants.TilemapLayers.CORRUPTION, corruption_tiles, 0, 0)
|
||||
i += 1
|
||||
|
||||
@@ -3,7 +3,8 @@ class_name Constants
|
||||
|
||||
enum TilemapLayers {
|
||||
GROUND = 0,
|
||||
CURSOR = 1,
|
||||
ENVIRONMENT = 2,
|
||||
BUILDINGS = 3,
|
||||
CORRUPTION = 1,
|
||||
CURSOR = 2,
|
||||
ENVIRONMENT = 3,
|
||||
BUILDINGS = 4,
|
||||
}
|
||||
|
||||
@@ -4,6 +4,9 @@ extends Node2D
|
||||
var noise_values
|
||||
@onready var world_grid = $world_grid
|
||||
|
||||
var resource_texture: Noise = FastNoiseLite.new()
|
||||
@export var resoure_quantity = 0.4
|
||||
|
||||
var temp_size = 150
|
||||
var temp_noise_val = []
|
||||
var temp_noise_reg = []
|
||||
@@ -13,6 +16,9 @@ var atlas_regions = [Vector2i(0,1),Vector2i(0,0),Vector2i(2,0),Vector2i(0,2)]
|
||||
|
||||
func get_noise_value(x: int, y: int):
|
||||
return noise_values.get_noise_2d(x,y) * 500
|
||||
|
||||
func is_resource_tile(x: int, y: int) -> bool:
|
||||
return resource_texture.get_noise_2d(x, y) > resoure_quantity
|
||||
|
||||
func get_noise_region(x,y):
|
||||
var noise_val = get_noise_value(x,y)
|
||||
@@ -21,10 +27,14 @@ func get_noise_region(x,y):
|
||||
return i
|
||||
|
||||
func _ready():
|
||||
resource_texture.seed = randi()
|
||||
#await resource_texture.changed
|
||||
noise_values = noise_texture.noise
|
||||
for x in range(-temp_size, temp_size):
|
||||
for y in range(-temp_size, temp_size):
|
||||
world_grid.set_cell(0, Vector2i(x,y),0,atlas_regions[get_noise_region(x,y)])
|
||||
world_grid.set_cell(Constants.TilemapLayers.GROUND, Vector2i(x,y),0,atlas_regions[get_noise_region(x,y)])
|
||||
if is_resource_tile(x,y):
|
||||
world_grid.set_cell(Constants.TilemapLayers.ENVIRONMENT, Vector2i(x,y), 0, Vector2i(5,6))
|
||||
temp_noise_val.append(get_noise_value(x,y))
|
||||
temp_noise_reg.append(get_noise_region(x,y))
|
||||
prints(temp_noise_val.min(), temp_noise_val.max())
|
||||
@@ -34,5 +44,5 @@ func _ready():
|
||||
|
||||
func _process(delta):
|
||||
var mouse_pos = world_grid.local_to_map(get_local_mouse_position())
|
||||
world_grid.clear_layer(1)
|
||||
world_grid.set_cell(1, mouse_pos,0,Vector2i(0,7))
|
||||
world_grid.clear_layer(Constants.TilemapLayers.CURSOR)
|
||||
world_grid.set_cell(Constants.TilemapLayers.CURSOR, mouse_pos,0,Vector2i(0,7))
|
||||
|
||||
Reference in New Issue
Block a user