mirror of
https://git.kittycat.homes/zoe/codename-routes.git
synced 2024-08-15 03:18:26 +00:00
optimize coastal tile spawning
This commit is contained in:
parent
9d34538009
commit
49ebacf34c
7 changed files with 78 additions and 68 deletions
|
@ -1,3 +1,3 @@
|
|||
source_md5="d9e2c01c9d17c3992a9e9fa5ce90bc73"
|
||||
dest_md5="d7da76c5ea5b80fda15196d356620194"
|
||||
source_md5="3384dd00c44f65297c45a26a1b808f2c"
|
||||
dest_md5="7f8383210199c01e63f81f4a23f2568b"
|
||||
|
||||
|
|
Binary file not shown.
Binary file not shown.
Before Width: | Height: | Size: 2.6 KiB After Width: | Height: | Size: 2.6 KiB |
|
@ -12,6 +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 = true
|
||||
tiles.append(tile)
|
||||
add_child(tile)
|
||||
update_size()
|
||||
|
|
70
World/Tiles/CoastalProps.tscn
Normal file
70
World/Tiles/CoastalProps.tscn
Normal file
|
@ -0,0 +1,70 @@
|
|||
[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]
|
||||
|
||||
[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"]
|
||||
|
||||
[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
|
||||
script = ExtResource( 1 )
|
||||
|
||||
[node name="Water" type="AnimatedSprite" parent="."]
|
||||
position = Vector2( 0, 16 )
|
||||
z_index = -1
|
||||
frames = SubResource( 1 )
|
||||
frame = 1
|
||||
playing = true
|
|
@ -1,8 +1,11 @@
|
|||
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())
|
||||
set_random_platform()
|
||||
|
||||
func change_color_to(color):
|
||||
|
|
|
@ -1,45 +1,7 @@
|
|||
[gd_scene load_steps=12 format=2]
|
||||
[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]
|
||||
[ext_resource path="res://Resources/Graphics/Tiles/platform.png" type="Texture" id=3]
|
||||
[ext_resource path="res://Resources/Graphics/Water/close_to_land.png" type="Texture" id=4]
|
||||
[ext_resource path="res://World/Tiles/Reflection.gd" type="Script" id=5]
|
||||
|
||||
[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( 4 )
|
||||
region = Rect2( 0, 0, 32, 32 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=3]
|
||||
atlas = ExtResource( 4 )
|
||||
region = Rect2( 32, 0, 32, 32 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=4]
|
||||
atlas = ExtResource( 4 )
|
||||
region = Rect2( 64, 0, 32, 32 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=5]
|
||||
atlas = ExtResource( 4 )
|
||||
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="Tile" type="Area2D"]
|
||||
script = ExtResource( 2 )
|
||||
|
@ -47,33 +9,6 @@ script = ExtResource( 2 )
|
|||
[node name="Sprite" type="Sprite" parent="."]
|
||||
texture = ExtResource( 1 )
|
||||
|
||||
[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
|
||||
script = ExtResource( 5 )
|
||||
|
||||
[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 )
|
||||
|
||||
[node name="Water" type="AnimatedSprite" parent="."]
|
||||
position = Vector2( 0, 16 )
|
||||
z_index = -1
|
||||
frames = SubResource( 1 )
|
||||
playing = true
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue