Compare commits

...

No commits in common. "5a78fe9898444e1a5bb11b86207a70897193c77d" and "f09f82a305468a97b0103f7e22df54566586eaee" have entirely different histories.

109 changed files with 531 additions and 922 deletions

1
.gitattributes vendored Normal file
View file

@ -0,0 +1 @@
*.gd linguist-language=GDScript

15
.gitignore vendored Normal file
View file

@ -0,0 +1,15 @@
/routes-native/target
/routes-native/Cargo.lock
*~
*.swp
*.swo
.fscache
.DS_Store
.DS_Store?
._*
.Spotlight-V100
.Trashes
ehthumbs.db
Thumbs.db
*.lnk

View file

@ -1,3 +0,0 @@
source_md5="c2ceedfd75487630e8ea3dabf6a2b9a8"
dest_md5="e8cb687282207ab1f7b495245c9750c7"

View file

@ -1,3 +0,0 @@
source_md5="faab8881882c2dd7d342bc32adada8a6"
dest_md5="f11ba84b73a027d723bf7a1bd9d7f206"

View file

@ -1,3 +0,0 @@
source_md5="669feed92f644398c1a1d4d49c923eea"
dest_md5="7f94170f05bbe3f73f5199f234b905ea"

View file

@ -1,3 +0,0 @@
source_md5="6bb298972ae11c8c9821caed7f258b66"
dest_md5="f2fd136a7ef0a6e044086e2ba56227c3"

View file

@ -1,3 +0,0 @@
source_md5="2752f228fecaeb92e0f2b076c28027ea"
dest_md5="878ce27f3864533955dba347e3812976"

View file

@ -1,3 +0,0 @@
source_md5="af9d5cf5b0e44e705c0df85d7c846c57"
dest_md5="9fb385faf18f3c43f7029b0d81164628"

View file

@ -1,3 +0,0 @@
source_md5="5cc3dacc9037b47e7183b7b4bfda4403"
dest_md5="78af387fb5a31697eb498e6814ab0f01"

View file

@ -1,3 +0,0 @@
source_md5="ea9c66f74493fe79d8ad87804f9d05d9"
dest_md5="cb4a12326cc8280988260062d802f136"

View file

@ -1,3 +0,0 @@
source_md5="9c3bc1326fd0badebe9e0a7931eaf86c"
dest_md5="e0dd63d56a05c39d8b755dd8edc3b2ad"

View file

@ -1,3 +0,0 @@
source_md5="8eadeb8bbf891f004e43352cc2e67542"
dest_md5="e4bcb9a55f2a4b582724442e7c362891"

View file

@ -1,3 +0,0 @@
source_md5="0bc636281e64916e731a8a6d8e40c0ff"
dest_md5="6af147d917b3d1ad2cb9fce4daf43d3d"

View file

@ -1,3 +0,0 @@
source_md5="b1c3441f4097c8ecb7b28e28e63031cc"
dest_md5="0ccc925a53515f2444c2ca7a6e6ff4eb"

View file

@ -1,3 +0,0 @@
source_md5="938048d60ddee2a80d56cecd6002b6e9"
dest_md5="92b4a796b3e171c0e7f0d6ada0086ab6"

View file

@ -1,6 +0,0 @@
extends Node
onready var rng = RandomNumberGenerator.new()
func set_seed(new_seed):
rng.seed = new_seed

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 193 B

View file

@ -1,35 +0,0 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/outline.png-254141a7dcf1bc01b7e07098c4c1c7a1.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://Resources/External/Graphics/Tiles/outline.png"
dest_files=[ "res://.import/outline.png-254141a7dcf1bc01b7e07098c4c1c7a1.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
process/normal_map_invert_y=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0

Binary file not shown.

View file

@ -1,35 +0,0 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/mulfok62-1x.png-6ecf59a597dd7a67f5b738d2c0239b7b.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://Resources/External/Graphics/mulfok62-1x.png"
dest_files=[ "res://.import/mulfok62-1x.png-6ecf59a597dd7a67f5b738d2c0239b7b.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
process/normal_map_invert_y=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0

Binary file not shown.

Before

Width:  |  Height:  |  Size: 278 B

View file

@ -1,35 +0,0 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/blue.png-2cd44d93824d3f98709a3749551f4ec1.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://Resources/Graphics/Tiles/blue.png"
dest_files=[ "res://.import/blue.png-2cd44d93824d3f98709a3749551f4ec1.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=false
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
process/normal_map_invert_y=false
stream=false
size_limit=0
detect_3d=false
svg/scale=1.0

Binary file not shown.

Before

Width:  |  Height:  |  Size: 277 B

View file

@ -1,35 +0,0 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/green.png-448f4aac7f20aee9994c54bdb3cf1731.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://Resources/Graphics/Tiles/green.png"
dest_files=[ "res://.import/green.png-448f4aac7f20aee9994c54bdb3cf1731.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=false
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
process/normal_map_invert_y=false
stream=false
size_limit=0
detect_3d=false
svg/scale=1.0

Binary file not shown.

Before

Width:  |  Height:  |  Size: 540 B

View file

@ -1,35 +0,0 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/platform.png-e79897c7ff8195dc0091ae3e9c22a315.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://Resources/Graphics/Tiles/platform.png"
dest_files=[ "res://.import/platform.png-e79897c7ff8195dc0091ae3e9c22a315.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=false
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
process/normal_map_invert_y=false
stream=false
size_limit=0
detect_3d=false
svg/scale=1.0

Binary file not shown.

Before

Width:  |  Height:  |  Size: 565 B

View file

@ -1,35 +0,0 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/platform2.png-cbd51a920a2794e07690642dfd7cd1d3.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://Resources/Graphics/Tiles/platform2.png"
dest_files=[ "res://.import/platform2.png-cbd51a920a2794e07690642dfd7cd1d3.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=false
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
process/normal_map_invert_y=false
stream=false
size_limit=0
detect_3d=false
svg/scale=1.0

Binary file not shown.

Before

Width:  |  Height:  |  Size: 556 B

View file

@ -1,35 +0,0 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/platform3.png-5311651b484696e407a2e6d5496f1c30.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://Resources/Graphics/Tiles/platform3.png"
dest_files=[ "res://.import/platform3.png-5311651b484696e407a2e6d5496f1c30.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=false
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
process/normal_map_invert_y=false
stream=false
size_limit=0
detect_3d=false
svg/scale=1.0

Binary file not shown.

Before

Width:  |  Height:  |  Size: 549 B

View file

@ -1,35 +0,0 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/platform4.png-b382dee3050ec03f5e07cd2a9931649e.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://Resources/Graphics/Tiles/platform4.png"
dest_files=[ "res://.import/platform4.png-b382dee3050ec03f5e07cd2a9931649e.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=false
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
process/normal_map_invert_y=false
stream=false
size_limit=0
detect_3d=false
svg/scale=1.0

Binary file not shown.

Before

Width:  |  Height:  |  Size: 278 B

View file

@ -1,35 +0,0 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/purple.png-32855686abb92c88335339d26d1584c7.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://Resources/Graphics/Tiles/purple.png"
dest_files=[ "res://.import/purple.png-32855686abb92c88335339d26d1584c7.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=false
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
process/normal_map_invert_y=false
stream=false
size_limit=0
detect_3d=false
svg/scale=1.0

Binary file not shown.

Before

Width:  |  Height:  |  Size: 278 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 279 B

View file

@ -1,35 +0,0 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/yellow.png-90e160c7824b62ddeb574a5e60507be3.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://Resources/Graphics/Tiles/yellow.png"
dest_files=[ "res://.import/yellow.png-90e160c7824b62ddeb574a5e60507be3.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=false
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
process/normal_map_invert_y=false
stream=false
size_limit=0
detect_3d=false
svg/scale=1.0

Binary file not shown.

Before

Width:  |  Height:  |  Size: 656 B

View file

@ -1,35 +0,0 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/close_to_land.png-01e739a54f71f449c550df208cfbaab1.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://Resources/Graphics/Water/close_to_land.png"
dest_files=[ "res://.import/close_to_land.png-01e739a54f71f449c550df208cfbaab1.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=false
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
process/normal_map_invert_y=false
stream=false
size_limit=0
detect_3d=false
svg/scale=1.0

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 KiB

View file

@ -1,35 +0,0 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/water1.png-96dd6aee434a7808b413abd6ab0e2583.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://Resources/Graphics/Water/water1.png"
dest_files=[ "res://.import/water1.png-96dd6aee434a7808b413abd6ab0e2583.stex" ]
[params]
compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=1
flags/filter=false
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
process/normal_map_invert_y=false
stream=false
size_limit=0
detect_3d=false
svg/scale=1.0

View file

@ -1,21 +0,0 @@
[gd_scene load_steps=4 format=2]
[ext_resource path="res://World/TileHandler.gd" type="Script" id=1]
[ext_resource path="res://World/Tools/Camera/Camera.tscn" type="PackedScene" id=2]
[ext_resource path="res://World/Props/WaterTexture.tscn" type="PackedScene" id=3]
[node name="Map" type="Node2D"]
[node name="BackgroundProps" type="Node2D" parent="."]
z_index = -1
[node name="WaterTexture" parent="BackgroundProps" instance=ExtResource( 3 )]
[node name="Grid" type="Node2D" parent="."]
script = ExtResource( 1 )
map_size = Vector2( 64, 64 )
[node name="CameraController" parent="." instance=ExtResource( 2 )]
[connection signal="size_updated" from="Grid" to="CameraController" method="_on_Grid_size_updated"]
[connection signal="limits_changed" from="CameraController" to="BackgroundProps/WaterTexture" method="_on_CameraController_limits_changed"]

View file

@ -1,10 +0,0 @@
extends TextureRect
func _on_CameraController_limits_changed(lefttop: Vector2, bottomright: Vector2) -> void:
rect_position = lefttop
rect_position.x -= 64
rect_position.y -= 64
rect_size.x = abs(lefttop.x) + bottomright.x + 64
rect_size.y = abs(lefttop.y) + bottomright.y + 64

View file

@ -1,16 +0,0 @@
[gd_scene load_steps=4 format=2]
[ext_resource path="res://Resources/Graphics/Water/water1.png" type="Texture" id=1]
[ext_resource path="res://World/Props/WaterTexture.gd" type="Script" id=2]
[sub_resource type="Animation" id=1]
resource_name = "Move"
[node name="WaterTexture" type="TextureRect"]
texture = ExtResource( 1 )
expand = true
stretch_mode = 2
script = ExtResource( 2 )
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
anims/Move = SubResource( 1 )

View file

@ -1,23 +0,0 @@
extends Node2D
export var map_size = Vector2(32, 16)
var tiles = []
signal size_updated(tiles)
func _ready() -> void:
spawn()
func spawn():
var Tile = preload("res://World/Tiles/Tile.tscn")
for x in range(0, map_size.x):
for y in range (0, map_size.y):
var tile = Tile.instance()
tile.set_tile_id(Vector2(x,y))
# tile is coast if its on one of the outer borders
if x == 0 or x == map_size.x -1 or y == 0 or y==map_size.y -1:
tile.is_coast = true
tiles.append(tile)
add_child(tile)
update_size()
func update_size():
emit_signal("size_updated", tiles)

View file

@ -1,17 +0,0 @@
extends Node2D
func _ready() -> void:
set_random_platform()
# selects one of the platform sprites randomly and picks it
func set_random_platform():
var sprite = $Platform
var reflection = $Reflection
var sprites = [
preload("res://Resources/Graphics/Tiles/platform.png"),
preload("res://Resources/Graphics/Tiles/platform2.png"),
preload("res://Resources/Graphics/Tiles/platform3.png"),
preload("res://Resources/Graphics/Tiles/platform4.png"),
]
sprite.texture = sprites[Randomizer.rng.randi_range(0, sprites.size() - 1)]
reflection.texture = sprite.texture

View file

@ -1,70 +0,0 @@
[gd_scene load_steps=10 format=2]
[ext_resource path="res://Resources/Graphics/Water/close_to_land.png" type="Texture" id=2]
[ext_resource path="res://Resources/Graphics/Tiles/platform.png" type="Texture" id=3]
[ext_resource path="res://World/Tiles/CoastalProps.gd" type="Script" id=4]
[sub_resource type="ParticlesMaterial" id=6]
emission_shape = 2
emission_box_extents = Vector3( 16, 1, 1 )
flag_disable_z = true
direction = Vector3( 0, -1, 0 )
gravity = Vector3( 0, 5, 0 )
initial_velocity = 10.0
initial_velocity_random = 0.5
orbit_velocity = 0.0
orbit_velocity_random = 0.0
[sub_resource type="AtlasTexture" id=2]
atlas = ExtResource( 2 )
region = Rect2( 0, 0, 32, 32 )
[sub_resource type="AtlasTexture" id=3]
atlas = ExtResource( 2 )
region = Rect2( 32, 0, 32, 32 )
[sub_resource type="AtlasTexture" id=4]
atlas = ExtResource( 2 )
region = Rect2( 64, 0, 32, 32 )
[sub_resource type="AtlasTexture" id=5]
atlas = ExtResource( 2 )
region = Rect2( 96, 0, 32, 32 )
[sub_resource type="SpriteFrames" id=1]
animations = [ {
"frames": [ SubResource( 2 ), SubResource( 3 ), SubResource( 4 ), SubResource( 5 ) ],
"loop": true,
"name": "default",
"speed": 2.0
} ]
[node name="CoastalProps" type="Node2D"]
script = ExtResource( 4 )
[node name="Platform" type="Sprite" parent="."]
position = Vector2( 0, 16 )
z_index = -1
texture = ExtResource( 3 )
[node name="Particles2D" type="Particles2D" parent="."]
position = Vector2( 0, 29 )
z_index = -1
amount = 2
lifetime = 2.0
randomness = 1.0
process_material = SubResource( 6 )
[node name="Reflection" type="Sprite" parent="."]
self_modulate = Color( 1, 1, 1, 0.113725 )
position = Vector2( 0, 37 )
z_index = -1
texture = ExtResource( 3 )
flip_v = true
[node name="Water" type="AnimatedSprite" parent="."]
position = Vector2( 0, 16 )
z_index = -1
frames = SubResource( 1 )
frame = 2
playing = true

View file

@ -1,6 +0,0 @@
extends Sprite
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
texture = get_node("../Platform").texture

View file

@ -1,31 +0,0 @@
extends Area2D
enum outline_colors{PURPLE, RED, BLUE, GREEN, YELLOW}
var tile_id = Vector2(0,0)
var is_coast = false
func _ready() -> void:
if is_coast:
add_child(preload("res://World/Tiles/CoastalProps.tscn").instance())
func change_color_to(color):
var sprite = $Sprite
if color == outline_colors.PURPLE:
sprite.texture = preload("res://Resources/Graphics/Tiles/purple.png")
elif color == outline_colors.RED:
sprite.texture = preload("res://Resources/Graphics/Tiles/red.png")
elif color == outline_colors.BLUE:
sprite.texture = preload("res://Resources/Graphics/Tiles/blue.png")
elif color == outline_colors.GREEN:
sprite.texture = preload("res://Resources/Graphics/Tiles/green.png")
elif color == outline_colors.YELLOW:
sprite.texture = preload("res://Resources/Graphics/Tiles/yellow.png")
func set_tile_id(id: Vector2):
tile_id = id
set_position(id)
func set_position(id: Vector2):
position.x = id.x * 32
position.y = id.y * 26
if (fmod(id.y, 2)) == 0:
position.x += 16

View file

@ -1,14 +0,0 @@
[gd_scene load_steps=3 format=2]
[ext_resource path="res://Resources/Graphics/Tiles/purple.png" type="Texture" id=1]
[ext_resource path="res://World/Tiles/Tile.gd" type="Script" id=2]
[node name="Tile" type="Area2D"]
script = ExtResource( 2 )
[node name="Sprite" type="Sprite" parent="."]
texture = ExtResource( 1 )
[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="."]
visible = false
polygon = PoolVector2Array( -15, -9, -14, -10, -12, -11, -9, -12, -7, -13, -4, -14, -2, -15, 2, -15, 4, -14, 7, -13, 9, -12, 12, -11, 14, -10, 15, -9, 15, 9, 14, 10, 12, 11, 9, 12, 7, 13, 4, 14, 2, 15, -2, 15, -4, 14, -7, 13, -9, 12, -12, 11, -14, 10, -15, 9 )

View file

@ -1,53 +0,0 @@
extends Camera2D
export var zoom_strength = 0.6
export var zoom_limit_upper = 2
export var zoom_limit_lower = 0.05
signal limits_changed(lefttop, bottomright)
func _process(_delta: float) -> void:
# position
var left = Input.get_action_strength("move_camera_left")
var right = Input.get_action_strength("move_camera_right")
var x_direction = right - left
var up = Input.get_action_strength("move_camera_up")
var down = Input.get_action_strength("move_camera_down")
var y_direction = down - up
var direction = Vector2(x_direction, y_direction)
global_position += direction.normalized() * zoom.x * 3
#mouse drag
if Input.is_action_pressed("camera_drag"):
var distance = clamp(global_position.distance_to(get_global_mouse_position()) / 24, 0, 10)
global_position.x += global_position.direction_to(get_global_mouse_position()).x * distance
global_position.y += global_position.direction_to(get_global_mouse_position()).y * distance
# if camera goes out of bounds, then reset it
var halfwidth = ProjectSettings.get("display/window/size/width") / 2
var halfheight = ProjectSettings.get("display/window/size/height") / 2
if global_position.x - halfwidth * (zoom.x) <= limit_left :
global_position.x = limit_left + (halfwidth) * (zoom.x)
elif global_position.x + halfwidth * zoom.x >= limit_right:
global_position.x = limit_right - halfwidth * zoom.x
if global_position.y - halfheight * zoom.x <= limit_top:
global_position.y = limit_top + halfheight * zoom.x
elif global_position.y + halfheight * zoom.x >= limit_bottom:
global_position.y = limit_bottom - halfheight * zoom.x
# zoom
var zoom_direction = 0
if Input.is_action_just_released("camera_zoom_in") or Input.is_action_pressed("camera_zoom_in"):
zoom_direction = zoom_strength * -1
elif Input.is_action_just_released("camera_zoom_out") or Input.is_action_pressed("camera_zoom_out"):
zoom_direction = zoom_strength
if zoom_limit_lower <= (zoom.x + zoom_direction) && (zoom.x + zoom_direction) <= zoom_limit_upper:
zoom.x = lerp(zoom.x, zoom.x + zoom_direction, 0.1)
zoom.y = lerp(zoom.y, zoom.y + zoom_direction, 0.1)
func _on_Grid_size_updated(tiles: Array) -> void:
limit_left = tiles.front().global_position.x - 64
limit_top = tiles.front().global_position.y - 64
limit_bottom = tiles.back().global_position.y + 64
limit_right = tiles.back().global_position.x + 64
position.x = limit_right / 2.0
position.y = limit_bottom / 2.0
emit_signal("limits_changed", Vector2(limit_left, limit_top), Vector2(limit_right, limit_bottom))

View file

@ -1,18 +0,0 @@
[gd_scene load_steps=3 format=2]
[ext_resource path="res://World/Tools/Camera/Camera.gd" type="Script" id=1]
[ext_resource path="res://icon.png" type="Texture" id=3]
[node name="Camera" type="Camera2D"]
current = true
smoothing_enabled = true
drag_margin_left = 0.8
drag_margin_top = 0.8
drag_margin_right = 0.8
drag_margin_bottom = 0.8
script = ExtResource( 1 )
[node name="Icon" type="Sprite" parent="."]
visible = false
position = Vector2( 0, -3 )
texture = ExtResource( 3 )

View file

@ -1,5 +0,0 @@
extends Node2D
func _physics_process(delta: float) -> void:
global_position = get_global_mouse_position()

7
build.sh Executable file
View file

@ -0,0 +1,7 @@
#!/usr/bin/bash
cd "./routes-native"
cargo build --release
cd "../"
cp "./routes-native/target/release/libroutes_native.so" "./godot/native/" -i

BIN
build/libroutes_native.so Normal file

Binary file not shown.

View file

@ -0,0 +1,3 @@
source_md5="72b25c45d4743c578ac08e56b209be81"
dest_md5="73042650bec74eec84c50b98d4bafc70"

View file

@ -0,0 +1,3 @@
source_md5="59c9436dc5ea53f2bc3dac38af894dec"
dest_md5="a62e530f259d2076dd7d2e62bc1d97b6"

View file

@ -7,7 +7,7 @@ custom_features=""
export_filter="all_resources"
include_filter=""
exclude_filter=""
export_path="Build/codename-routes.x86_64"
export_path="../build/routes.x86_64"
script_export_mode=1
script_encryption_key=""

View file

Before

Width:  |  Height:  |  Size: 3.2 KiB

After

Width:  |  Height:  |  Size: 3.2 KiB

View file

@ -0,0 +1,8 @@
[gd_resource type="NativeScript" load_steps=2 format=2]
[ext_resource path="res://native/nativelibrary.gdnlib" type="GDNativeLibrary" id=1]
[resource]
resource_name = "StateServer"
class_name = "StateServer"
library = ExtResource( 1 )

View file

@ -0,0 +1,6 @@
[gd_scene load_steps=2 format=2]
[ext_resource path="res://native/StateServer.gdns" type="Script" id=1]
[node name="StateServer" type="Node"]
script = ExtResource( 1 )

BIN
godot/native/libroutes_native.so Executable file

Binary file not shown.

View file

@ -0,0 +1,14 @@
[entry]
X11.64="res://native/libroutes_native.so"
[dependencies]
X11.64=[ ]
[general]
singleton=false
load_once=true
symbol_prefix="godot_"
reloadable=true

82
godot/project.godot Normal file
View file

@ -0,0 +1,82 @@
; Engine configuration file.
; It's best edited using the editor UI and not directly,
; since the parameters that go here are not all obvious.
;
; Format:
; [section] ; section goes between []
; param=value ; assign values to parameters
config_version=4
[application]
config/name="routes"
run/main_scene="res://world/Main.tscn"
config/icon="res://icon.png"
[importer_defaults]
texture={
"compress/bptc_ldr": 0,
"compress/hdr_mode": 0,
"compress/lossy_quality": 0.7,
"compress/mode": 0,
"compress/normal_map": 0,
"detect_3d": false,
"flags/anisotropic": false,
"flags/filter": false,
"flags/mipmaps": false,
"flags/repeat": 0,
"flags/srgb": 2,
"process/HDR_as_SRGB": false,
"process/fix_alpha_border": true,
"process/invert_color": false,
"process/normal_map_invert_y": false,
"process/premult_alpha": false,
"size_limit": 0,
"stream": false,
"svg/scale": 1.0
}
[input]
camera_left={
"deadzone": 0.5,
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":65,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
]
}
camera_up={
"deadzone": 0.5,
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":87,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
]
}
camera_right={
"deadzone": 0.5,
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":68,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
]
}
camera_down={
"deadzone": 0.5,
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":83,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
]
}
zoom_in={
"deadzone": 0.5,
"events": [ Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"button_mask":0,"position":Vector2( 0, 0 ),"global_position":Vector2( 0, 0 ),"factor":1.0,"button_index":1,"pressed":false,"doubleclick":false,"script":null)
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":true,"control":false,"meta":false,"command":false,"pressed":false,"scancode":61,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
]
}
zoom_out={
"deadzone": 0.5,
"events": [ Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"button_mask":0,"position":Vector2( 0, 0 ),"global_position":Vector2( 0, 0 ),"factor":1.0,"button_index":5,"pressed":false,"doubleclick":false,"script":null)
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":45,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
]
}
[physics]
common/enable_pause_aware_picking=true
[rendering]
environment/default_environment="res://default_env.tres"

16
godot/saves.gd Normal file
View file

@ -0,0 +1,16 @@
extends Node
# Declare member variables here. Examples:
# var a = 2
# var b = "text"
# Called when the node enters the scene tree for the first time.
func _ready():
pass # Replace with function body.
# Called every frame. 'delta' is the elapsed time since the previous frame.
#func _process(delta):
# pass

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.8 KiB

View file

@ -2,15 +2,15 @@
importer="texture"
type="StreamTexture"
path="res://.import/red.png-c3051ca11bb5b8c8686a8a85a9586dff.stex"
path="res://.import/default.png-13971fa1f37d4ea367b7aa5973d2bb0a.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://Resources/Graphics/Tiles/red.png"
dest_files=[ "res://.import/red.png-c3051ca11bb5b8c8686a8a85a9586dff.stex" ]
source_file="res://sprite/tiles/terrain/default.png"
dest_files=[ "res://.import/default.png-13971fa1f37d4ea367b7aa5973d2bb0a.stex" ]
[params]

13
godot/world/Main.tscn Normal file
View file

@ -0,0 +1,13 @@
[gd_scene load_steps=3 format=2]
[ext_resource path="res://world/worldcam.gd" type="Script" id=1]
[ext_resource path="res://world/World.tscn" type="PackedScene" id=2]
[node name="Main" type="Node2D"]
[node name="Worldcam" type="Camera2D" parent="."]
current = true
zoom = Vector2( 0.4, 0.4 )
script = ExtResource( 1 )
[node name="World" parent="." instance=ExtResource( 2 )]

37
godot/world/StateApi.gd Normal file
View file

@ -0,0 +1,37 @@
extends Node
onready var server = $StateServer
export var xsize = 256
export var ysize = 256
export var zsize = 16
var Tilemap = preload("res://world/Tilemap.tscn")
var tilemaps = []
func _ready():
server.generate_world(xsize, ysize, zsize)
print(server.get_tile_at(0,0,0))
func respawn_tilemaps(amount: int):
tilemaps = []
for i in range(0, amount + 1):
var map = Tilemap.instance()
map.position.y -= i * map.cell_size.y
map.z_index = i
add_child(map)
tilemaps.push_back(map)
func get_tile_at(pos: Vector3) -> String:
return server.get_tile_at(int(pos.x), int(pos.y), int(pos.z))
func update_tiles(tile_positions: PoolVector3Array):
for tile in tile_positions:
tilemaps[tile.z].set_tile_graphics(Vector2(tile.x, tile.y),
get_tile_at(tile))
func _on_StateServer_request_init():
respawn_tilemaps(zsize - 1)
func _on_StateServer_changed_tiletypes(tile_positions: PoolVector3Array):
call_deferred("update_tiles", tile_positions)

4
godot/world/Tilemap.gd Normal file
View file

@ -0,0 +1,4 @@
extends TileMap
func set_tile_graphics(pos: Vector2, id: int):
set_cell(pos.x,pos.y,0,false,false,false,Vector2(1,2))

15
godot/world/Tilemap.tscn Normal file
View file

@ -0,0 +1,15 @@
[gd_scene load_steps=3 format=2]
[ext_resource path="res://world/terrain/terrain.tres" type="TileSet" id=1]
[ext_resource path="res://world/Tilemap.gd" type="Script" id=2]
[node name="Tilemap" type="TileMap"]
position = Vector2( -2, 0 )
mode = 1
tile_set = ExtResource( 1 )
cell_size = Vector2( 32, 16 )
cell_tile_origin = 1
collision_layer = 0
collision_mask = 0
format = 1
script = ExtResource( 2 )

12
godot/world/World.tscn Normal file
View file

@ -0,0 +1,12 @@
[gd_scene load_steps=3 format=2]
[ext_resource path="res://world/StateApi.gd" type="Script" id=1]
[ext_resource path="res://native/StateServer.tscn" type="PackedScene" id=3]
[node name="World" type="Node"]
script = ExtResource( 1 )
[node name="StateServer" parent="." instance=ExtResource( 3 )]
[connection signal="changed_tiletypes" from="StateServer" to="." method="_on_StateServer_changed_tiletypes"]
[connection signal="request_init" from="StateServer" to="." method="_on_StateServer_request_init"]

View file

@ -0,0 +1,10 @@
[gd_resource type="NativeScript" load_steps=2 format=2]
[sub_resource type="GDNativeLibrary" id=1]
entry/X11.64 = "res://native/libroutes_native.so"
dependency/X11.64 = [ ]
[resource]
resource_name = "StateServer"
class_name = "StateServer"
library = SubResource( 1 )

View file

@ -0,0 +1,26 @@
[gd_resource type="TileSet" load_steps=2 format=2]
[ext_resource path="res://sprite/tiles/terrain/default.png" type="Texture" id=1]
[resource]
0/name = "default.png 0"
0/texture = ExtResource( 1 )
0/tex_offset = Vector2( 0, 0 )
0/modulate = Color( 1, 1, 1, 1 )
0/region = Rect2( 0, 0, 320, 160 )
0/tile_mode = 2
0/autotile/icon_coordinate = Vector2( 0, 0 )
0/autotile/tile_size = Vector2( 32, 32 )
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/shape_offset = Vector2( 0, 0 )
0/shape_transform = Transform2D( 1, 0, 0, 1, 0, 0 )
0/shape_one_way = false
0/shape_one_way_margin = 0.0
0/shapes = [ ]
0/z_index = 0

22
godot/world/worldcam.gd Normal file
View file

@ -0,0 +1,22 @@
extends Camera2D
export var min_zoom = 0.4
export var speed = 200
var zoomlevel = 0.4
func _process(delta):
move_around(delta)
handle_zoom()
func move_around(delta):
var xdirection = Input.get_action_strength("camera_right") - Input.get_action_strength("camera_left")
var ydirection = Input.get_action_strength("camera_down") - Input.get_action_strength("camera_up")
var direction = Vector2(xdirection, ydirection).normalized() * delta * speed * zoom
position = lerp(position, position + direction, 2)
func handle_zoom():
if Input.is_action_just_pressed("zoom_in"):
zoomlevel = clamp(zoomlevel - 0.1, 0.1, 2)
if Input.is_action_just_pressed("zoom_out"):
zoomlevel = clamp(zoomlevel + 0.1, 0.1, 2)
zoom = Vector2(zoomlevel, zoomlevel)

View file

Before

Width:  |  Height:  |  Size: 347 B

After

Width:  |  Height:  |  Size: 347 B

Binary file not shown.

Some files were not shown because too many files have changed in this diff Show more