Compare commits
3 Commits
75a720eb45
...
f31a6ee0c2
Author | SHA1 | Date | |
---|---|---|---|
f31a6ee0c2 | |||
fe0d76e370 | |||
beabc319e5 |
1
.gitignore
vendored
1
.gitignore
vendored
@ -6,3 +6,4 @@
|
|||||||
export_presets.cfg
|
export_presets.cfg
|
||||||
|
|
||||||
/AuthKey_VSYTQ75GZQ.p8
|
/AuthKey_VSYTQ75GZQ.p8
|
||||||
|
*.dds
|
||||||
|
@ -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,8 +13,9 @@ 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)
|
||||||
$Player.position = homes[0].position
|
$Unit.position = homes[0].position
|
||||||
next_home = homes[1].position
|
next_home = homes[1].position
|
||||||
homes = [homes[0], homes[1], homes[3], homes[2]]
|
homes = [homes[0], homes[1], homes[3], homes[2]]
|
||||||
pass
|
pass
|
||||||
@ -25,8 +26,9 @@ func is_home(tile):
|
|||||||
|
|
||||||
# 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):
|
||||||
if $Player.position != next_home:
|
var move_speed = delta * 60.0
|
||||||
$Player.position = $Player.position.move_toward(next_home, 4)
|
if $Unit.position != next_home:
|
||||||
|
$Unit.position = $Unit.position.move_toward(next_home, move_speed * 8)
|
||||||
else:
|
else:
|
||||||
x += 1
|
x += 1
|
||||||
next_home = homes[x % 4].position
|
next_home = homes[x % 4].position
|
||||||
@ -43,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="Player" parent="." instance=ExtResource("2_oi7aa")]
|
[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")]
|
||||||
|
@ -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
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
extends Camera2D
|
extends Camera2D
|
||||||
class_name PanningCamera2D
|
|
||||||
|
|
||||||
@export var MIN_ZOOM: float = 0.5
|
@export var MIN_ZOOM: float = 0.5
|
||||||
@export var MAX_ZOOM: float = 3.0
|
@export var MAX_ZOOM: float = 3.0
|
||||||
|
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.
|
||||||
|
//}
|
@ -1,24 +0,0 @@
|
|||||||
extends Node2D
|
|
||||||
|
|
||||||
var yvel = 1
|
|
||||||
var yoff = 0
|
|
||||||
|
|
||||||
|
|
||||||
# Called when the node enters the scene tree for the first time.
|
|
||||||
func _ready():
|
|
||||||
$Sprite2D.texture = PakAssetLoader.load_file("user://data/units.pak/tomomo_00_00.dat")
|
|
||||||
$Sprite2D.position = get_global_transform().origin
|
|
||||||
$Sprite2D.position.y -= 128
|
|
||||||
|
|
||||||
|
|
||||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
|
||||||
func _process(_delta):
|
|
||||||
var pos = get_global_transform().origin
|
|
||||||
pos.y += -128 + yoff
|
|
||||||
yvel -= 1
|
|
||||||
if yvel < -9:
|
|
||||||
yvel = 9
|
|
||||||
pos.y += yvel
|
|
||||||
yoff += yvel
|
|
||||||
$Sprite2D.position = pos
|
|
||||||
|
|
@ -1,13 +0,0 @@
|
|||||||
[gd_scene load_steps=2 format=3 uid="uid://dtm0201qhcn4d"]
|
|
||||||
|
|
||||||
[ext_resource type="Script" path="res://Player/player.gd" id="1_6ggpr"]
|
|
||||||
|
|
||||||
[node name="Player" type="Node2D"]
|
|
||||||
z_index = 1
|
|
||||||
script = ExtResource("1_6ggpr")
|
|
||||||
metadata/_edit_group_ = true
|
|
||||||
|
|
||||||
[node name="Sprite2D" type="Sprite2D" parent="."]
|
|
||||||
top_level = true
|
|
||||||
z_index = 2
|
|
||||||
position = Vector2(2.08165e-12, -128)
|
|
21
Unit/unit.gd
Normal file
21
Unit/unit.gd
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
extends Node2D
|
||||||
|
|
||||||
|
var yvel = 1
|
||||||
|
var yoff = 0
|
||||||
|
|
||||||
|
|
||||||
|
# Called when the node enters the scene tree for the first time.
|
||||||
|
func _ready():
|
||||||
|
$UnitSprite.texture = PakAssetLoader.load_file("user://data/units.pak/tomomo_00_00.dat")
|
||||||
|
$UnitSprite.position = get_parent().to_global(position)
|
||||||
|
$UnitSprite/AnimationPlayer.play("move")
|
||||||
|
$UnitSprite/AnimationPlayer.speed_scale = 1
|
||||||
|
|
||||||
|
$RingSprite.texture = PakAssetLoader.load_file("user://data/system.pak/playerring1.dat")
|
||||||
|
$RingSprite/AnimationPlayer.play("spin")
|
||||||
|
|
||||||
|
|
||||||
|
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||||
|
func _process(_delta):
|
||||||
|
$UnitSprite.position = get_parent().to_global(position)
|
||||||
|
pass
|
134
Unit/unit.tscn
Normal file
134
Unit/unit.tscn
Normal file
@ -0,0 +1,134 @@
|
|||||||
|
[gd_scene load_steps=9 format=3 uid="uid://dtm0201qhcn4d"]
|
||||||
|
|
||||||
|
[ext_resource type="Script" path="res://Unit/unit.gd" id="1_6ggpr"]
|
||||||
|
|
||||||
|
[sub_resource type="Animation" id="Animation_ijbbj"]
|
||||||
|
length = 0.001
|
||||||
|
tracks/0/type = "value"
|
||||||
|
tracks/0/imported = false
|
||||||
|
tracks/0/enabled = true
|
||||||
|
tracks/0/path = NodePath(".:rotation")
|
||||||
|
tracks/0/interp = 1
|
||||||
|
tracks/0/loop_wrap = true
|
||||||
|
tracks/0/keys = {
|
||||||
|
"times": PackedFloat32Array(0),
|
||||||
|
"transitions": PackedFloat32Array(1),
|
||||||
|
"update": 0,
|
||||||
|
"values": [0.0]
|
||||||
|
}
|
||||||
|
|
||||||
|
[sub_resource type="Animation" id="Animation_wu12n"]
|
||||||
|
resource_name = "spin"
|
||||||
|
length = 7.00001
|
||||||
|
loop_mode = 1
|
||||||
|
tracks/0/type = "value"
|
||||||
|
tracks/0/imported = false
|
||||||
|
tracks/0/enabled = true
|
||||||
|
tracks/0/path = NodePath(".:rotation")
|
||||||
|
tracks/0/interp = 1
|
||||||
|
tracks/0/loop_wrap = false
|
||||||
|
tracks/0/keys = {
|
||||||
|
"times": PackedFloat32Array(0, 7),
|
||||||
|
"transitions": PackedFloat32Array(1, 1),
|
||||||
|
"update": 0,
|
||||||
|
"values": [0.0, 6.28319]
|
||||||
|
}
|
||||||
|
|
||||||
|
[sub_resource type="AnimationLibrary" id="AnimationLibrary_fvvof"]
|
||||||
|
_data = {
|
||||||
|
"RESET": SubResource("Animation_ijbbj"),
|
||||||
|
"spin": SubResource("Animation_wu12n")
|
||||||
|
}
|
||||||
|
|
||||||
|
[sub_resource type="Animation" id="Animation_nsm8w"]
|
||||||
|
length = 0.001
|
||||||
|
tracks/0/type = "value"
|
||||||
|
tracks/0/imported = false
|
||||||
|
tracks/0/enabled = true
|
||||||
|
tracks/0/path = NodePath(".:scale")
|
||||||
|
tracks/0/interp = 1
|
||||||
|
tracks/0/loop_wrap = true
|
||||||
|
tracks/0/keys = {
|
||||||
|
"times": PackedFloat32Array(0),
|
||||||
|
"transitions": PackedFloat32Array(1),
|
||||||
|
"update": 0,
|
||||||
|
"values": [Vector2(1, 1)]
|
||||||
|
}
|
||||||
|
tracks/1/type = "value"
|
||||||
|
tracks/1/imported = false
|
||||||
|
tracks/1/enabled = true
|
||||||
|
tracks/1/path = NodePath(".:offset")
|
||||||
|
tracks/1/interp = 1
|
||||||
|
tracks/1/loop_wrap = true
|
||||||
|
tracks/1/keys = {
|
||||||
|
"times": PackedFloat32Array(0),
|
||||||
|
"transitions": PackedFloat32Array(1),
|
||||||
|
"update": 0,
|
||||||
|
"values": [Vector2(2.08165e-12, -128)]
|
||||||
|
}
|
||||||
|
|
||||||
|
[sub_resource type="Animation" id="Animation_yme65"]
|
||||||
|
resource_name = "idle"
|
||||||
|
length = 1.2
|
||||||
|
loop_mode = 2
|
||||||
|
tracks/0/type = "value"
|
||||||
|
tracks/0/imported = false
|
||||||
|
tracks/0/enabled = true
|
||||||
|
tracks/0/path = NodePath(".:scale")
|
||||||
|
tracks/0/interp = 1
|
||||||
|
tracks/0/loop_wrap = true
|
||||||
|
tracks/0/keys = {
|
||||||
|
"times": PackedFloat32Array(0, 1.2),
|
||||||
|
"transitions": PackedFloat32Array(-2, 1),
|
||||||
|
"update": 0,
|
||||||
|
"values": [Vector2(1, 1), Vector2(1.05, 0.97)]
|
||||||
|
}
|
||||||
|
|
||||||
|
[sub_resource type="Animation" id="Animation_mqx3b"]
|
||||||
|
resource_name = "move"
|
||||||
|
length = 0.116668
|
||||||
|
loop_mode = 2
|
||||||
|
step = 0.0166667
|
||||||
|
tracks/0/type = "value"
|
||||||
|
tracks/0/imported = false
|
||||||
|
tracks/0/enabled = true
|
||||||
|
tracks/0/path = NodePath(".:offset")
|
||||||
|
tracks/0/interp = 1
|
||||||
|
tracks/0/loop_wrap = true
|
||||||
|
tracks/0/keys = {
|
||||||
|
"times": PackedFloat32Array(0, 0.116667),
|
||||||
|
"transitions": PackedFloat32Array(0.435275, 1),
|
||||||
|
"update": 0,
|
||||||
|
"values": [Vector2(2.08165e-12, -128), Vector2(2.08165e-12, -158)]
|
||||||
|
}
|
||||||
|
|
||||||
|
[sub_resource type="AnimationLibrary" id="AnimationLibrary_8dthf"]
|
||||||
|
_data = {
|
||||||
|
"RESET": SubResource("Animation_nsm8w"),
|
||||||
|
"idle": SubResource("Animation_yme65"),
|
||||||
|
"move": SubResource("Animation_mqx3b")
|
||||||
|
}
|
||||||
|
|
||||||
|
[node name="Unit" type="Node2D"]
|
||||||
|
z_index = 1
|
||||||
|
script = ExtResource("1_6ggpr")
|
||||||
|
metadata/_edit_group_ = true
|
||||||
|
|
||||||
|
[node name="RingSprite" type="Sprite2D" parent="."]
|
||||||
|
flip_v = true
|
||||||
|
|
||||||
|
[node name="AnimationPlayer" type="AnimationPlayer" parent="RingSprite"]
|
||||||
|
libraries = {
|
||||||
|
"": SubResource("AnimationLibrary_fvvof")
|
||||||
|
}
|
||||||
|
|
||||||
|
[node name="UnitSprite" type="Sprite2D" parent="."]
|
||||||
|
top_level = true
|
||||||
|
z_index = 2
|
||||||
|
offset = Vector2(2.08165e-12, -128)
|
||||||
|
flip_h = true
|
||||||
|
|
||||||
|
[node name="AnimationPlayer" type="AnimationPlayer" parent="UnitSprite"]
|
||||||
|
libraries = {
|
||||||
|
"": SubResource("AnimationLibrary_8dthf")
|
||||||
|
}
|
12
main.gd
Normal file
12
main.gd
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
extends Node2D
|
||||||
|
|
||||||
|
|
||||||
|
# Called when the node enters the scene tree for the first time.
|
||||||
|
func _ready():
|
||||||
|
var center = $Field.to_global($Field.tiles[$Field.tiles.size() / 2].position)
|
||||||
|
$Camera2D.position = center
|
||||||
|
$Camera2D.reset_pos = center
|
||||||
|
|
||||||
|
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||||
|
func _process(_delta):
|
||||||
|
pass
|
12
main.tscn
12
main.tscn
@ -1,14 +1,20 @@
|
|||||||
[gd_scene load_steps=3 format=3 uid="uid://djirenq1psstj"]
|
[gd_scene load_steps=4 format=3 uid="uid://djirenq1psstj"]
|
||||||
|
|
||||||
|
[ext_resource type="Script" path="res://main.gd" id="1_2dcib"]
|
||||||
[ext_resource type="Script" path="res://PanningCamera/PanningCamera2D.gd" id="1_vtapg"]
|
[ext_resource type="Script" path="res://PanningCamera/PanningCamera2D.gd" id="1_vtapg"]
|
||||||
[ext_resource type="PackedScene" uid="uid://qipfodwbk1gf" path="res://Field/field.tscn" id="1_y0qkv"]
|
[ext_resource type="PackedScene" uid="uid://qipfodwbk1gf" path="res://Field/field.tscn" id="1_y0qkv"]
|
||||||
|
|
||||||
[node name="Main" type="Node2D"]
|
[node name="Main" type="Node2D"]
|
||||||
|
script = ExtResource("1_2dcib")
|
||||||
|
metadata/_edit_group_ = true
|
||||||
|
|
||||||
[node name="Camera2D" type="Camera2D" parent="."]
|
[node name="Camera2D" type="Camera2D" parent="."]
|
||||||
|
limit_left = -5000
|
||||||
|
limit_top = -2000
|
||||||
|
limit_right = 5000
|
||||||
|
limit_bottom = 4000
|
||||||
|
editor_draw_limits = true
|
||||||
script = ExtResource("1_vtapg")
|
script = ExtResource("1_vtapg")
|
||||||
MIN_ZOOM = null
|
|
||||||
MAX_ZOOM = null
|
|
||||||
ZOOM_RATE = 5.0
|
ZOOM_RATE = 5.0
|
||||||
|
|
||||||
[node name="Field" parent="." instance=ExtResource("1_y0qkv")]
|
[node name="Field" parent="." instance=ExtResource("1_y0qkv")]
|
||||||
|
@ -15,13 +15,18 @@ run/main_scene="res://main.tscn"
|
|||||||
config/features=PackedStringArray("4.2", "GL Compatibility")
|
config/features=PackedStringArray("4.2", "GL Compatibility")
|
||||||
config/icon="res://icon.svg"
|
config/icon="res://icon.svg"
|
||||||
|
|
||||||
|
[debug]
|
||||||
|
|
||||||
|
gdscript/warnings/integer_division=0
|
||||||
|
|
||||||
[display]
|
[display]
|
||||||
|
|
||||||
window/size/viewport_width=1920
|
window/size/viewport_width=1920
|
||||||
window/size/viewport_height=1080
|
window/size/viewport_height=1080
|
||||||
|
window/vsync/vsync_mode=0
|
||||||
|
|
||||||
[rendering]
|
[rendering]
|
||||||
|
|
||||||
renderer/rendering_method="gl_compatibility"
|
renderer/rendering_method="mobile"
|
||||||
renderer/rendering_method.mobile="gl_compatibility"
|
renderer/rendering_method.mobile="gl_compatibility"
|
||||||
textures/vram_compression/import_etc2_astc=true
|
textures/vram_compression/import_etc2_astc=true
|
||||||
|
Loading…
Reference in New Issue
Block a user