diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..1ff0c42 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,63 @@ +############################################################################### +# Set default behavior to automatically normalize line endings. +############################################################################### +* text=auto + +############################################################################### +# Set default behavior for command prompt diff. +# +# This is need for earlier builds of msysgit that does not have it on by +# default for csharp files. +# Note: This is only used by command line +############################################################################### +#*.cs diff=csharp + +############################################################################### +# Set the merge driver for project and solution files +# +# Merging from the command prompt will add diff markers to the files if there +# are conflicts (Merging from VS is not affected by the settings below, in VS +# the diff markers are never inserted). Diff markers may cause the following +# file extensions to fail to load in VS. An alternative would be to treat +# these files as binary and thus will always conflict and require user +# intervention with every merge. To do so, just uncomment the entries below +############################################################################### +#*.sln merge=binary +#*.csproj merge=binary +#*.vbproj merge=binary +#*.vcxproj merge=binary +#*.vcproj merge=binary +#*.dbproj merge=binary +#*.fsproj merge=binary +#*.lsproj merge=binary +#*.wixproj merge=binary +#*.modelproj merge=binary +#*.sqlproj merge=binary +#*.wwaproj merge=binary + +############################################################################### +# behavior for image files +# +# image files are treated as binary by default. +############################################################################### +#*.jpg binary +#*.png binary +#*.gif binary + +############################################################################### +# diff behavior for common document formats +# +# Convert binary document formats to text before diffing them. This feature +# is only available from the command line. Turn it on by uncommenting the +# entries below. +############################################################################### +#*.doc diff=astextplain +#*.DOC diff=astextplain +#*.docx diff=astextplain +#*.DOCX diff=astextplain +#*.dot diff=astextplain +#*.DOT diff=astextplain +#*.pdf diff=astextplain +#*.PDF diff=astextplain +#*.rtf diff=astextplain +#*.RTF diff=astextplain diff --git a/.gitiginore b/.gitignore similarity index 75% rename from .gitiginore rename to .gitignore index 09e0014..cbc6def 100644 --- a/.gitiginore +++ b/.gitignore @@ -1,5 +1,10 @@ -# Created by https://www.gitignore.io/api/linux,godot,macos,backup,windows,visualstudiocode -# Edit at https://www.gitignore.io/?templates=linux,godot,macos,backup,windows,visualstudiocode +### Audio ### + +*.wav +*.ogg + +# Created by https://www.gitignore.io/api/linux,godot,macos,backup,windows,dotnetcore,executable,monodevelop,visualstudiocode +# Edit at https://www.gitignore.io/?templates=linux,godot,macos,backup,windows,dotnetcore,executable,monodevelop,visualstudiocode ### Backup ### *.bak @@ -8,6 +13,28 @@ *.orig *.tmp +### DotnetCore ### +# .NET Core build folders +/bin +/obj + +# Common node modules locations +/node_modules +/wwwroot/node_modules + + +### Executable ### +*.app +*.bat +*.cgi +*.com +*.exe +*.gadget +*.jar +*.pif +*.vb +*.wsf + ### Godot ### # Godot-specific ignores @@ -61,6 +88,16 @@ Network Trash Folder Temporary Items .apdisk +### MonoDevelop ### +#User Specific +*.userprefs +*.usertasks + +#Mono Project Files +*.pidb +*.resources +test-results/ + ### VisualStudioCode ### .vscode/* !.vscode/settings.json @@ -98,4 +135,4 @@ $RECYCLE.BIN/ # Windows shortcuts *.lnk -# End of https://www.gitignore.io/api/linux,godot,macos,backup,windows,visualstudiocode \ No newline at end of file +# End of https://www.gitignore.io/api/linux,godot,macos,backup,windows,dotnetcore,executable,monodevelop,visualstudiocode \ No newline at end of file diff --git a/assets/terrain_cl.ase b/assets/terrain_cl.ase new file mode 100644 index 0000000..0e81af3 Binary files /dev/null and b/assets/terrain_cl.ase differ diff --git a/src/graphics/terrain_cl.png b/src/graphics/terrain_cl.png new file mode 100644 index 0000000..879317f Binary files /dev/null and b/src/graphics/terrain_cl.png differ diff --git a/src/graphics/terrain_cl.png.import b/src/graphics/terrain_cl.png.import new file mode 100644 index 0000000..a52d11b --- /dev/null +++ b/src/graphics/terrain_cl.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/terrain_cl.png-d78bff616c0deecb3dc6c30085d2553c.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://graphics/terrain_cl.png" +dest_files=[ "res://.import/terrain_cl.png-d78bff616c0deecb3dc6c30085d2553c.stex" ] + +[params] + +compress/mode=0 +compress/lossy_quality=0.7 +compress/hdr_mode=0 +compress/bptc_ldr=0 +compress/normal_map=0 +flags/repeat=0 +flags/filter=true +flags/mipmaps=false +flags/anisotropic=false +flags/srgb=2 +process/fix_alpha_border=true +process/premult_alpha=false +process/HDR_as_SRGB=false +process/invert_color=false +stream=false +size_limit=0 +detect_3d=true +svg/scale=1.0 diff --git a/src/graphics/terrian.tres b/src/graphics/terrian.tres new file mode 100644 index 0000000..8598779 --- /dev/null +++ b/src/graphics/terrian.tres @@ -0,0 +1,24 @@ +[gd_resource type="TileSet" load_steps=2 format=2] + +[ext_resource path="res://graphics/terrain_cl.png" type="Texture" id=1] + +[resource] +0/name = "terrain_cl.png 0" +0/texture = ExtResource( 1 ) +0/tex_offset = Vector2( 0, 0 ) +0/modulate = Color( 1, 1, 1, 1 ) +0/region = Rect2( 0, 0, 16, 288 ) +0/tile_mode = 1 +0/autotile/bitmask_mode = 1 +0/autotile/bitmask_flags = [ Vector2( 0, 0 ), 511, Vector2( 0, 1 ), 7, Vector2( 0, 2 ), 7, Vector2( 0, 3 ), 311, Vector2( 0, 4 ), 311, Vector2( 0, 5 ), 292, Vector2( 0, 6 ), 292, Vector2( 0, 7 ), 484, Vector2( 0, 8 ), 500, Vector2( 0, 9 ), 448, Vector2( 0, 10 ), 448, Vector2( 0, 11 ), 457, Vector2( 0, 12 ), 457, Vector2( 0, 13 ), 73, Vector2( 0, 14 ), 73, Vector2( 0, 15 ), 79, Vector2( 0, 16 ), 79 ] +0/autotile/icon_coordinate = Vector2( 0, 0 ) +0/autotile/tile_size = Vector2( 16, 16 ) +0/autotile/spacing = 0 +0/autotile/occluder_map = [ ] +0/autotile/navpoly_map = [ ] +0/autotile/priority_map = [ ] +0/autotile/z_index_map = [ ] +0/occluder_offset = Vector2( 0, 0 ) +0/navigation_offset = Vector2( 0, 0 ) +0/shapes = [ ] +0/z_index = 0 diff --git a/src/project.godot b/src/project.godot index 28c8094..863a2bc 100644 --- a/src/project.godot +++ b/src/project.godot @@ -15,7 +15,8 @@ _global_script_class_icons={ [application] -config/name="CityLimits" +config/name="City Limits" +run/main_scene="res://world.tscn" config/icon="res://icon.png" [rendering] diff --git a/src/world.gd b/src/world.gd new file mode 100644 index 0000000..1df6b57 --- /dev/null +++ b/src/world.gd @@ -0,0 +1,25 @@ +extends Node2D + +var noise : OpenSimplexNoise +var map_size = Vector2(80, 60) +var grass_cap = 0.5 +var road_caps = Vector2(0.3, 0.05) + +func _ready(): + randomize() + noise = OpenSimplexNoise.new() + noise.seed = randi() + noise.octaves = 1.5 + noise.period = 12 + + make_terrian_map() + + +func make_terrian_map(): + for x in map_size.x: + for y in map_size.y: + var a = noise.get_noise_2d(x, y) + if a < grass_cap: + $Terrian.set_cell(x, y, 0) + + $Terrian.update_bitmask_region(Vector2(0.0, 0.0), Vector2(map_size.x, map_size.y)) \ No newline at end of file diff --git a/src/world.tscn b/src/world.tscn index 81a3f05..e0f19dc 100644 --- a/src/world.tscn +++ b/src/world.tscn @@ -1,10 +1,12 @@ -[gd_scene load_steps=2 format=2] +[gd_scene load_steps=3 format=2] -[ext_resource path="res://graphics/roads.tres" type="TileSet" id=1] +[ext_resource path="res://world.gd" type="Script" id=1] +[ext_resource path="res://graphics/terrian.tres" type="TileSet" id=2] [node name="Node2D" type="Node2D"] +script = ExtResource( 1 ) -[node name="Roads" type="TileMap" parent="."] -tile_set = ExtResource( 1 ) +[node name="Terrian" type="TileMap" parent="."] +tile_set = ExtResource( 2 ) cell_size = Vector2( 16, 16 ) format = 1 diff --git a/src/world_gen.gd b/src/world_gen.gd deleted file mode 100644 index 427b09e..0000000 --- a/src/world_gen.gd +++ /dev/null @@ -1,36 +0,0 @@ -extends Node2D - -var noise : OpenSimplexNoise -var map_size = Vector2(80, 60) -var grass_cap = 0.5 -var road_caps = Vector2(0.3, 0.05) - -func _ready(): - randomize() - noise = OpenSimplexNoise.new() - noise.seed = randi() - noise.octaves = 1.5 - noise.period = 12 - - make_grass_map() - make_road_map() - - -func make_grass_map(): - for x in map_size.x: - for y in map_size.y: - var a = noise.get_noise_2d(x, y) - if a < grass_cap: - $Grass.set_cell(x, y, 0) - - $Grass.update_bitmask_region(Vector2(0.0, 0.0), Vector2(map_size.x, map_size.y)) - - -func make_road_map(): - for x in map_size.x: - for y in map_size.y: - var a = noise.get_noise_2d(x, y) - if a < road_caps.x and a > road_caps.y: - $Roads.set_cell(x, y, 0) - - $Roads.update_bitmask_region(Vector2(0.0, 0.0), Vector2(map_size.x, map_size.y))