add scrolling bg + fix tile data
This commit is contained in:
parent
beabc319e5
commit
fe0d76e370
@ -34,7 +34,8 @@ enum TileID {
|
|||||||
TileUnknown = 30,
|
TileUnknown = 30,
|
||||||
TileCoopBoss = 31,
|
TileCoopBoss = 31,
|
||||||
TileDamage = 32,
|
TileDamage = 32,
|
||||||
TileDamagex2 = 33
|
TileDamagex2 = 33,
|
||||||
|
TileMud = 34
|
||||||
}
|
}
|
||||||
|
|
||||||
static func get_tile_texture(id: int):
|
static func get_tile_texture(id: int):
|
||||||
@ -61,10 +62,11 @@ static func get_tile_texture(id: int):
|
|||||||
24: return "mass_warpmoveL2.dat"
|
24: return "mass_warpmoveL2.dat"
|
||||||
25: return "mass_snow0.dat"
|
25: return "mass_snow0.dat"
|
||||||
26: return "mass_snow0.dat"
|
26: return "mass_snow0.dat"
|
||||||
27: return "mass_heal0.dat"
|
27: return "mass_heal.dat"
|
||||||
28: return "mass_healL2.dat"
|
28: return "mass_healL2.dat"
|
||||||
29: return "mass_common0.dat"
|
29: return "mass_common0.dat"
|
||||||
30: return "mass_common0.dat"
|
30: return "mass_common0.dat"
|
||||||
31: return "mass_boss.dat"
|
31: return "mass_boss.dat"
|
||||||
32: return "mass_damage.dat"
|
32: return "mass_damage0.dat"
|
||||||
33: return "mass_damageL2.dat"
|
33: return "mass_damageL2.dat"
|
||||||
|
34: return "mass_mud.dat"
|
@ -13,6 +13,7 @@ func _init():
|
|||||||
|
|
||||||
# Called when the node enters the scene tree for the first time.
|
# Called when the node enters the scene tree for the first time.
|
||||||
func _ready():
|
func _ready():
|
||||||
|
$BGSprite.texture = PakAssetLoader.load_file("user://data/fields.pak/practice_l.dat")
|
||||||
homes = tiles.filter(is_home)
|
homes = tiles.filter(is_home)
|
||||||
$Unit.position = homes[0].position
|
$Unit.position = homes[0].position
|
||||||
next_home = homes[1].position
|
next_home = homes[1].position
|
||||||
@ -44,11 +45,9 @@ func create_from_buffer(bytes: PackedByteArray):
|
|||||||
for i in range(0, num_tiles):
|
for i in range(0, num_tiles):
|
||||||
var tile = load("res://Field/tile.tscn").instantiate()
|
var tile = load("res://Field/tile.tscn").instantiate()
|
||||||
tile.id = bytes.decode_u32(i * 8)
|
tile.id = bytes.decode_u32(i * 8)
|
||||||
var exit_bits = bytes.decode_u8((i * 8) + 4)
|
# var exit_bits = bytes.decode_u8((i * 8) + 4)
|
||||||
add_child.call_deferred(tile)
|
add_child.call_deferred(tile)
|
||||||
tile.position = Vector2(((i % width) * 158) + 64, (j * 158) + 64)
|
tile.position = Vector2(((i % width) * 158) + 64, (j * 158) + 64)
|
||||||
tiles.append(tile)
|
tiles.append(tile)
|
||||||
if i % height == height - 1:
|
if i % height == height - 1:
|
||||||
j += 1
|
j += 1
|
||||||
#print(bytes)
|
|
||||||
pass
|
|
||||||
|
@ -1,9 +1,23 @@
|
|||||||
[gd_scene load_steps=3 format=3 uid="uid://qipfodwbk1gf"]
|
[gd_scene load_steps=5 format=3 uid="uid://qipfodwbk1gf"]
|
||||||
|
|
||||||
[ext_resource type="Script" path="res://Field/field.gd" id="1_6uvjw"]
|
[ext_resource type="Script" path="res://Field/field.gd" id="1_6uvjw"]
|
||||||
[ext_resource type="PackedScene" uid="uid://dtm0201qhcn4d" path="res://Player/player.tscn" id="2_oi7aa"]
|
[ext_resource type="PackedScene" uid="uid://dtm0201qhcn4d" path="res://Unit/unit.tscn" id="2_jhvjp"]
|
||||||
|
[ext_resource type="Shader" path="res://PanningCamera/background.gdshader" id="3_l3ah4"]
|
||||||
|
|
||||||
|
[sub_resource type="ShaderMaterial" id="ShaderMaterial_jb3sl"]
|
||||||
|
shader = ExtResource("3_l3ah4")
|
||||||
|
|
||||||
[node name="Field" type="Node2D"]
|
[node name="Field" type="Node2D"]
|
||||||
script = ExtResource("1_6uvjw")
|
script = ExtResource("1_6uvjw")
|
||||||
|
metadata/_edit_group_ = true
|
||||||
|
|
||||||
|
[node name="BGSprite" type="Sprite2D" parent="."]
|
||||||
|
texture_repeat = 2
|
||||||
|
material = SubResource("ShaderMaterial_jb3sl")
|
||||||
|
position = Vector2(900, 900)
|
||||||
|
scale = Vector2(2, 2)
|
||||||
|
offset = Vector2(2.08165e-12, 2.08165e-12)
|
||||||
|
region_enabled = true
|
||||||
|
region_rect = Rect2(2.08165e-12, -704, 6000, 6000)
|
||||||
|
|
||||||
[node name="Unit" parent="." instance=ExtResource("2_jhvjp")]
|
[node name="Unit" parent="." instance=ExtResource("2_jhvjp")]
|
||||||
|
@ -22,5 +22,5 @@ func _ready():
|
|||||||
|
|
||||||
|
|
||||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||||
func _process(delta):
|
func _process(_delta):
|
||||||
pass
|
pass
|
||||||
|
14
PanningCamera/background.gdshader
Normal file
14
PanningCamera/background.gdshader
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
shader_type canvas_item;
|
||||||
|
|
||||||
|
const float y_speed = 0.5 / 3.0;
|
||||||
|
const float x_speed = 0.1 / 3.0;
|
||||||
|
|
||||||
|
void fragment() {
|
||||||
|
vec2 new_uv = vec2(UV.x + TIME * x_speed, UV.y + TIME * y_speed);
|
||||||
|
COLOR = texture(TEXTURE, new_uv);
|
||||||
|
}
|
||||||
|
|
||||||
|
//void light() {
|
||||||
|
// Called for every pixel for every light affecting the CanvasItem.
|
||||||
|
// Uncomment to replace the default light processing function with this one.
|
||||||
|
//}
|
Loading…
Reference in New Issue
Block a user