even more water

This commit is contained in:
zoe 2022-03-26 00:51:42 +01:00
parent 49ebacf34c
commit 5a78fe9898
7 changed files with 24 additions and 16 deletions

View File

@ -1,3 +1,3 @@
source_md5="3384dd00c44f65297c45a26a1b808f2c"
dest_md5="7f8383210199c01e63f81f4a23f2568b"
source_md5="b1c3441f4097c8ecb7b28e28e63031cc"
dest_md5="0ccc925a53515f2444c2ca7a6e6ff4eb"

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.6 KiB

After

Width:  |  Height:  |  Size: 3.3 KiB

View File

@ -12,7 +12,8 @@ func spawn():
for y in range (0, map_size.y):
var tile = Tile.instance()
tile.set_tile_id(Vector2(x,y))
if x == 0 or x == map_size.x -1 or y== 0 or y==map_size.y -1:
# 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)

View File

@ -0,0 +1,17 @@
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,8 +1,8 @@
[gd_scene load_steps=10 format=2]
[ext_resource path="res://World/Tiles/Reflection.gd" type="Script" id=1]
[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
@ -40,6 +40,7 @@ animations = [ {
} ]
[node name="CoastalProps" type="Node2D"]
script = ExtResource( 4 )
[node name="Platform" type="Sprite" parent="."]
position = Vector2( 0, 16 )
@ -60,11 +61,10 @@ position = Vector2( 0, 37 )
z_index = -1
texture = ExtResource( 3 )
flip_v = true
script = ExtResource( 1 )
[node name="Water" type="AnimatedSprite" parent="."]
position = Vector2( 0, 16 )
z_index = -1
frames = SubResource( 1 )
frame = 1
frame = 2
playing = true

View File

@ -6,7 +6,6 @@ var is_coast = false
func _ready() -> void:
if is_coast:
add_child(preload("res://World/Tiles/CoastalProps.tscn").instance())
set_random_platform()
func change_color_to(color):
var sprite = $Sprite
@ -30,12 +29,3 @@ func set_position(id: Vector2):
position.y = id.y * 26
if (fmod(id.y, 2)) == 0:
position.x += 16
func set_random_platform():
var sprite = $Platform
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"),
]