初次提交

This commit is contained in:
mydataway_yangzhe 2020-07-21 20:34:34 +08:00
commit 7ca0be1f81
29 changed files with 1176 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
/*.log

View File

@ -0,0 +1,3 @@
source_md5="47313fa4c47a9963fddd764e1ec6e4a8"
dest_md5="2ded9e7f9060e2b530aab678b135fc5b"

View File

@ -0,0 +1,3 @@
source_md5="47313fa4c47a9963fddd764e1ec6e4a8"
dest_md5="2ded9e7f9060e2b530aab678b135fc5b"

Binary file not shown.

View File

@ -0,0 +1,3 @@
source_md5="47313fa4c47a9963fddd764e1ec6e4a8"
dest_md5="2ded9e7f9060e2b530aab678b135fc5b"

Binary file not shown.

View File

@ -0,0 +1,3 @@
source_md5="7e41bf3051b18e392a4bb6c0cc45cd7c"
dest_md5="92eb858faaa1840609e0a1d10f0a2ab1"

View File

@ -0,0 +1,3 @@
source_md5="60514c3844e365d1aecfc555e1a44548"
dest_md5="1adb04621553370458c19304359c525f"

Binary file not shown.

27
MainScene.tscn Normal file
View File

@ -0,0 +1,27 @@
[gd_scene load_steps=5 format=2]
[ext_resource path="res://scenes/UI.tscn" type="PackedScene" id=1]
[ext_resource path="res://scripts/NavigationTileMap.gd" type="Script" id=2]
[ext_resource path="res://scenes/Player.tscn" type="PackedScene" id=3]
[ext_resource path="res://images/mota_tileset.tres" type="TileSet" id=4]
[node name="2D" type="Node2D"]
[node name="BackgroundTileMap" type="TileMap" parent="."]
tile_set = ExtResource( 4 )
cell_size = Vector2( 32, 32 )
cell_custom_transform = Transform2D( 32, 0, 0, 32, 0, 0 )
format = 1
tile_data = PoolIntArray( 0, 1, 0, 1, 1, 0, 2, 1, 0, 3, 1, 0, 17, 1, 0, 18, 1, 0, 19, 1, 0, 20, 1, 0, 65536, 1, 0, 65537, 1, 0, 65538, 1, 0, 65539, 1, 0, 65553, 1, 0, 65554, 1, 0, 65555, 1, 0, 65556, 1, 0, 131072, 1, 0, 131073, 1, 0, 131074, 1, 0, 131075, 1, 0, 131089, 1, 0, 131090, 1, 0, 131091, 1, 0, 131092, 1, 0, 196608, 1, 0, 196609, 1, 0, 196610, 1, 0, 196611, 1, 0, 196625, 1, 0, 196626, 1, 0, 196627, 1, 0, 196628, 1, 0, 262144, 1, 0, 262145, 1, 0, 262146, 1, 0, 262147, 1, 0, 262161, 1, 0, 262162, 1, 0, 262163, 1, 0, 262164, 1, 0, 327680, 1, 0, 327681, 1, 0, 327682, 1, 0, 327683, 1, 0, 327697, 1, 0, 327698, 1, 0, 327699, 1, 0, 327700, 1, 0, 393216, 1, 0, 393217, 1, 0, 393218, 1, 0, 393219, 1, 0, 393233, 1, 0, 393234, 1, 0, 393235, 1, 0, 393236, 1, 0, 458752, 1, 0, 458753, 1, 0, 458754, 1, 0, 458755, 1, 0, 458769, 1, 0, 458770, 1, 0, 458771, 1, 0, 458772, 1, 0, 524288, 1, 0, 524289, 1, 0, 524290, 1, 0, 524291, 1, 0, 524305, 1, 0, 524306, 1, 0, 524307, 1, 0, 524308, 1, 0, 589824, 1, 0, 589825, 1, 0, 589826, 1, 0, 589827, 1, 0, 589841, 1, 0, 589842, 1, 0, 589843, 1, 0, 589844, 1, 0, 655360, 1, 0, 655361, 1, 0, 655362, 1, 0, 655363, 1, 0, 655377, 1, 0, 655378, 1, 0, 655379, 1, 0, 655380, 1, 0, 720896, 1, 0, 720897, 1, 0, 720898, 1, 0, 720899, 1, 0, 720913, 1, 0, 720914, 1, 0, 720915, 1, 0, 720916, 1, 0, 786432, 1, 0, 786433, 1, 0, 786434, 1, 0, 786435, 1, 0, 786449, 1, 0, 786450, 1, 0, 786451, 1, 0, 786452, 1, 0 )
[node name="UI" parent="." instance=ExtResource( 1 )]
[node name="NavigationTileMap" type="TileMap" parent="."]
tile_set = ExtResource( 4 )
cell_size = Vector2( 32, 32 )
collision_mask = 2147483649
format = 1
tile_data = PoolIntArray( 196618, 2, 0, 262151, 2, 0, 262152, 2, 0, 262153, 2, 0, 262154, 2, 0, 262155, 2, 0, 262156, 2, 0, 262157, 2, 0, 327687, 2, 0, 327690, 2, 0, 327693, 2, 0, 393222, 2, 0, 393223, 2, 0, 393224, 2, 0, 393225, 2, 0, 393226, 2, 0, 393227, 2, 0, 393228, 2, 0, 393229, 2, 0, 393230, 2, 0, 393231, 2, 0, 458759, 2, 0, 458760, 2, 0, 458762, 2, 0, 458765, 2, 0, 524296, 2, 0, 524297, 2, 0, 524298, 2, 0, 524299, 2, 0, 524300, 2, 0, 524301, 2, 0, 589834, 2, 0 )
script = ExtResource( 2 )
[node name="PlayerKinematicBody2D" parent="." instance=ExtResource( 3 )]

223
export_presets.cfg Normal file
View File

@ -0,0 +1,223 @@
[preset.0]
name="HTML5"
platform="HTML5"
runnable=true
custom_features=""
export_filter="all_resources"
include_filter=""
exclude_filter=""
export_path="export/index.html"
patch_list=PoolStringArray( )
script_export_mode=1
script_encryption_key=""
[preset.0.options]
vram_texture_compression/for_desktop=true
vram_texture_compression/for_mobile=true
html/custom_html_shell=""
html/head_include=""
custom_template/release=""
custom_template/debug=""
[preset.1]
name="Android"
platform="Android"
runnable=true
custom_features=""
export_filter="all_resources"
include_filter=""
exclude_filter=""
export_path="export/mota.apk"
patch_list=PoolStringArray( )
script_export_mode=1
script_encryption_key=""
[preset.1.options]
graphics/32_bits_framebuffer=true
xr_features/xr_mode=0
xr_features/degrees_of_freedom=0
xr_features/hand_tracking=0
xr_features/focus_awareness=false
one_click_deploy/clear_previous_install=false
custom_template/debug=""
custom_template/release=""
custom_template/use_custom_build=false
command_line/extra_args=""
version/code=1
version/name="1.0"
package/unique_name="org.godotengine.$genname"
package/name=""
package/signed=true
screen/immersive_mode=true
screen/orientation=0
screen/support_small=true
screen/support_normal=true
screen/support_large=true
screen/support_xlarge=true
screen/opengl_debug=false
launcher_icons/main_192x192=""
launcher_icons/adaptive_foreground_432x432=""
launcher_icons/adaptive_background_432x432=""
keystore/debug=""
keystore/debug_user=""
keystore/debug_password=""
keystore/release=""
keystore/release_user=""
keystore/release_password=""
apk_expansion/enable=false
apk_expansion/SALT=""
apk_expansion/public_key=""
architectures/armeabi-v7a=true
architectures/arm64-v8a=false
architectures/x86=false
architectures/x86_64=false
permissions/custom_permissions=PoolStringArray( )
permissions/access_checkin_properties=false
permissions/access_coarse_location=false
permissions/access_fine_location=false
permissions/access_location_extra_commands=false
permissions/access_mock_location=false
permissions/access_network_state=false
permissions/access_surface_flinger=false
permissions/access_wifi_state=false
permissions/account_manager=false
permissions/add_voicemail=false
permissions/authenticate_accounts=false
permissions/battery_stats=false
permissions/bind_accessibility_service=false
permissions/bind_appwidget=false
permissions/bind_device_admin=false
permissions/bind_input_method=false
permissions/bind_nfc_service=false
permissions/bind_notification_listener_service=false
permissions/bind_print_service=false
permissions/bind_remoteviews=false
permissions/bind_text_service=false
permissions/bind_vpn_service=false
permissions/bind_wallpaper=false
permissions/bluetooth=false
permissions/bluetooth_admin=false
permissions/bluetooth_privileged=false
permissions/brick=false
permissions/broadcast_package_removed=false
permissions/broadcast_sms=false
permissions/broadcast_sticky=false
permissions/broadcast_wap_push=false
permissions/call_phone=false
permissions/call_privileged=false
permissions/camera=false
permissions/capture_audio_output=false
permissions/capture_secure_video_output=false
permissions/capture_video_output=false
permissions/change_component_enabled_state=false
permissions/change_configuration=false
permissions/change_network_state=false
permissions/change_wifi_multicast_state=false
permissions/change_wifi_state=false
permissions/clear_app_cache=false
permissions/clear_app_user_data=false
permissions/control_location_updates=false
permissions/delete_cache_files=false
permissions/delete_packages=false
permissions/device_power=false
permissions/diagnostic=false
permissions/disable_keyguard=false
permissions/dump=false
permissions/expand_status_bar=false
permissions/factory_test=false
permissions/flashlight=false
permissions/force_back=false
permissions/get_accounts=false
permissions/get_package_size=false
permissions/get_tasks=false
permissions/get_top_activity_info=false
permissions/global_search=false
permissions/hardware_test=false
permissions/inject_events=false
permissions/install_location_provider=false
permissions/install_packages=false
permissions/install_shortcut=false
permissions/internal_system_window=false
permissions/internet=false
permissions/kill_background_processes=false
permissions/location_hardware=false
permissions/manage_accounts=false
permissions/manage_app_tokens=false
permissions/manage_documents=false
permissions/master_clear=false
permissions/media_content_control=false
permissions/modify_audio_settings=false
permissions/modify_phone_state=false
permissions/mount_format_filesystems=false
permissions/mount_unmount_filesystems=false
permissions/nfc=false
permissions/persistent_activity=false
permissions/process_outgoing_calls=false
permissions/read_calendar=false
permissions/read_call_log=false
permissions/read_contacts=false
permissions/read_external_storage=false
permissions/read_frame_buffer=false
permissions/read_history_bookmarks=false
permissions/read_input_state=false
permissions/read_logs=false
permissions/read_phone_state=false
permissions/read_profile=false
permissions/read_sms=false
permissions/read_social_stream=false
permissions/read_sync_settings=false
permissions/read_sync_stats=false
permissions/read_user_dictionary=false
permissions/reboot=false
permissions/receive_boot_completed=false
permissions/receive_mms=false
permissions/receive_sms=false
permissions/receive_wap_push=false
permissions/record_audio=false
permissions/reorder_tasks=false
permissions/restart_packages=false
permissions/send_respond_via_message=false
permissions/send_sms=false
permissions/set_activity_watcher=false
permissions/set_alarm=false
permissions/set_always_finish=false
permissions/set_animation_scale=false
permissions/set_debug_app=false
permissions/set_orientation=false
permissions/set_pointer_speed=false
permissions/set_preferred_applications=false
permissions/set_process_limit=false
permissions/set_time=false
permissions/set_time_zone=false
permissions/set_wallpaper=false
permissions/set_wallpaper_hints=false
permissions/signal_persistent_processes=false
permissions/status_bar=false
permissions/subscribed_feeds_read=false
permissions/subscribed_feeds_write=false
permissions/system_alert_window=false
permissions/transmit_ir=false
permissions/uninstall_shortcut=false
permissions/update_device_stats=false
permissions/use_credentials=false
permissions/use_sip=false
permissions/vibrate=false
permissions/wake_lock=false
permissions/write_apn_settings=false
permissions/write_calendar=false
permissions/write_call_log=false
permissions/write_contacts=false
permissions/write_external_storage=false
permissions/write_gservices=false
permissions/write_history_bookmarks=false
permissions/write_profile=false
permissions/write_secure_settings=false
permissions/write_settings=false
permissions/write_sms=false
permissions/write_social_stream=false
permissions/write_sync_settings=false
permissions/write_user_dictionary=false

Binary file not shown.

BIN
images/mota.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 49 KiB

34
images/mota.png.import Normal file
View File

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/mota.png-02d33da8bf0f085bff84efd72f4babc5.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://images/mota.png"
dest_files=[ "res://.import/mota.png-02d33da8bf0f085bff84efd72f4babc5.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
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0

62
images/mota_tileset.tres Normal file
View File

@ -0,0 +1,62 @@
[gd_resource type="TileSet" load_steps=4 format=2]
[ext_resource path="res://images/mota.png" type="Texture" id=1]
[sub_resource type="ConvexPolygonShape2D" id=1]
points = PoolVector2Array( 0, 0, 32, 0, 32, 32, 0, 32 )
[sub_resource type="NavigationPolygon" id=2]
vertices = PoolVector2Array( 12.8379, -3.70605, 12.9995, 7.7608, 11.8689, 13.575, -5.4122, 14.7056, -5.4122, 18.5817, 11.7074, 18.2587, 12.3534, 36.5088, 18.4906, 36.5088, 17.1986, 19.0662, 39.8093, 18.7432, 38.1943, 11.7985, 18.4906, 12.606, 18.4906, -4.02911 )
polygons = [ PoolIntArray( 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 ) ]
[resource]
0/name = "mota.png 0"
0/texture = ExtResource( 1 )
0/tex_offset = Vector2( 0, 0 )
0/modulate = Color( 1, 1, 1, 1 )
0/region = Rect2( 0, 512, 32, 32 )
0/tile_mode = 0
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 = SubResource( 1 )
0/shape_one_way = false
0/shape_one_way_margin = 1.0
0/shapes = [ {
"autotile_coord": Vector2( 0, 0 ),
"one_way": false,
"one_way_margin": 1.0,
"shape": SubResource( 1 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
} ]
0/z_index = 0
1/name = "mota.png 1"
1/texture = ExtResource( 1 )
1/tex_offset = Vector2( 0, 0 )
1/modulate = Color( 1, 1, 1, 1 )
1/region = Rect2( 32, 512, 32, 32 )
1/tile_mode = 0
1/occluder_offset = Vector2( 0, 0 )
1/navigation_offset = Vector2( 0, 0 )
1/shape_offset = Vector2( 0, 0 )
1/shape_transform = Transform2D( 1, 0, 0, 1, 0, 0 )
1/shape_one_way = false
1/shape_one_way_margin = 0.0
1/shapes = [ ]
1/z_index = 0
2/name = "mota.png 2"
2/texture = ExtResource( 1 )
2/tex_offset = Vector2( 0, 0 )
2/modulate = Color( 1, 1, 1, 1 )
2/region = Rect2( 256, 512, 32, 32 )
2/tile_mode = 0
2/occluder_offset = Vector2( 0, 0 )
2/navigation_offset = Vector2( 0, 0 )
2/navigation = SubResource( 2 )
2/shape_offset = Vector2( 0, 0 )
2/shape_transform = Transform2D( 1, 0, 0, 1, 0, 0 )
2/shape_one_way = false
2/shape_one_way_margin = 0.0
2/shapes = [ ]
2/z_index = 0

68
project.godot Normal file
View File

@ -0,0 +1,68 @@
; 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
_global_script_classes=[ {
"base": "Tween",
"class": "ArrayTween",
"language": "GDScript",
"path": "res://scripts/ArrayTween.gd"
}, {
"base": "Node",
"class": "GameArchive",
"language": "GDScript",
"path": "res://scripts/GameArchive.gd"
}, {
"base": "TileMap",
"class": "NavigationTileMap",
"language": "GDScript",
"path": "res://scripts/NavigationTileMap.gd"
}, {
"base": "KinematicBody2D",
"class": "PlayerKinematicBody2D",
"language": "GDScript",
"path": "res://scripts/PlayerKinematicBody2D.gd"
}, {
"base": "Object",
"class": "PlayerProperty",
"language": "GDScript",
"path": "res://scripts/PlayerProperty.gd"
}, {
"base": "Sprite",
"class": "PlayerSprite",
"language": "GDScript",
"path": "res://scripts/PlayerSprite.gd"
} ]
_global_script_class_icons={
"ArrayTween": "",
"GameArchive": "",
"NavigationTileMap": "",
"PlayerKinematicBody2D": "",
"PlayerProperty": "",
"PlayerSprite": ""
}
[application]
config/name="mota"
run/main_scene="res://MainScene.tscn"
config/icon="res://settings/icon.png"
[display]
window/size/width=672
window/size/height=416
window/size/always_on_top=true
window/dpi/allow_hidpi=true
window/stretch/mode="2d"
window/stretch/aspect="keep"
[rendering]
environment/default_environment="res://settings/default_env.tres"

146
scenes/Player.tscn Normal file
View File

@ -0,0 +1,146 @@
[gd_scene load_steps=17 format=2]
[ext_resource path="res://scripts/PlayerSprite.gd" type="Script" id=1]
[ext_resource path="res://scripts/PlayerKinematicBody2D.gd" type="Script" id=2]
[ext_resource path="res://scripts/ArrayTween.gd" type="Script" id=3]
[ext_resource path="res://images/mota.png" type="Texture" id=4]
[sub_resource type="RectangleShape2D" id=1]
extents = Vector2( 8, 8 )
[sub_resource type="Animation" id=4]
resource_name = "down"
length = 1.2
tracks/0/type = "value"
tracks/0/path = NodePath("PlayerSprite:frame")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/keys = {
"times": PoolRealArray( 0, 0.4, 0.8 ),
"transitions": PoolRealArray( 1, 1, 1 ),
"update": 1,
"values": [ 0, 1, 2 ]
}
[sub_resource type="Animation" id=2]
resource_name = "left"
length = 1.2
loop = true
tracks/0/type = "value"
tracks/0/path = NodePath("PlayerSprite:frame")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/keys = {
"times": PoolRealArray( 0, 0.4, 0.8 ),
"transitions": PoolRealArray( 1, 1, 1 ),
"update": 1,
"values": [ 6, 7, 8 ]
}
[sub_resource type="Animation" id=3]
resource_name = "right"
length = 1.2
loop = true
tracks/0/type = "value"
tracks/0/path = NodePath("PlayerSprite:frame")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/keys = {
"times": PoolRealArray( 0, 0.4, 0.8 ),
"transitions": PoolRealArray( 1, 1, 1 ),
"update": 1,
"values": [ 9, 10, 11 ]
}
[sub_resource type="Animation" id=5]
resource_name = "up"
length = 1.2
loop = true
tracks/0/type = "value"
tracks/0/path = NodePath("PlayerSprite:frame")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/keys = {
"times": PoolRealArray( 0, 0.4, 0.8 ),
"transitions": PoolRealArray( 1, 1, 1 ),
"update": 1,
"values": [ 3, 4, 5 ]
}
[sub_resource type="AnimationNodeTimeScale" id=12]
[sub_resource type="AnimationNodeAnimation" id=6]
animation = "right"
[sub_resource type="AnimationNodeAnimation" id=7]
animation = "up"
[sub_resource type="AnimationNodeAnimation" id=8]
animation = "down"
[sub_resource type="AnimationNodeAnimation" id=9]
animation = "left"
[sub_resource type="AnimationNodeBlendSpace2D" id=10]
blend_point_0/node = SubResource( 6 )
blend_point_0/pos = Vector2( 1, 0 )
blend_point_1/node = SubResource( 7 )
blend_point_1/pos = Vector2( 0, -0.9 )
blend_point_2/node = SubResource( 8 )
blend_point_2/pos = Vector2( 0, 1 )
blend_point_3/node = SubResource( 9 )
blend_point_3/pos = Vector2( -1, 0 )
blend_mode = 1
[sub_resource type="AnimationNodeBlendTree" id=11]
nodes/TimeScale/node = SubResource( 12 )
nodes/TimeScale/position = Vector2( 340, 40 )
nodes/output/position = Vector2( 580, 60 )
nodes/player/node = SubResource( 10 )
nodes/player/position = Vector2( 120, 40 )
node_connections = [ "TimeScale", 0, "player", "output", 0, "TimeScale" ]
[node name="PlayerKinematicBody2D" type="KinematicBody2D"]
position = Vector2( 336, 208 )
script = ExtResource( 2 )
__meta__ = {
"_edit_group_": true
}
navigation_tile_map_path = NodePath("../NavigationTileMap")
[node name="ArrayTween" type="Tween" parent="."]
script = ExtResource( 3 )
duration = 0.1
[node name="PlayerSprite" type="Sprite" parent="."]
texture = ExtResource( 4 )
vframes = 3
hframes = 4
region_enabled = true
region_rect = Rect2( 192, 192, 128, 96 )
script = ExtResource( 1 )
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
shape = SubResource( 1 )
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
anims/down = SubResource( 4 )
anims/left = SubResource( 2 )
anims/right = SubResource( 3 )
anims/up = SubResource( 5 )
[node name="AnimationTree" type="AnimationTree" parent="."]
tree_root = SubResource( 11 )
anim_player = NodePath("../AnimationPlayer")
parameters/TimeScale/scale = 10.0
parameters/player/blend_position = Vector2( -0.0495575, -0.190751 )
[connection signal="array_completed" from="ArrayTween" to="." method="_on_ArrayTween_array_completed"]
[connection signal="array_value_step" from="ArrayTween" to="." method="_on_ArrayTween_array_value_step"]

342
scenes/UI.tscn Normal file
View File

@ -0,0 +1,342 @@
[gd_scene load_steps=12 format=2]
[ext_resource path="res://images/mota.png" type="Texture" id=2]
[ext_resource path="res://fonts/Droid Sans Fallback.ttf" type="DynamicFontData" id=3]
[sub_resource type="DynamicFont" id=1]
size = 14
font_data = ExtResource( 3 )
[sub_resource type="DynamicFont" id=2]
font_data = ExtResource( 3 )
[sub_resource type="DynamicFont" id=3]
size = 12
font_data = ExtResource( 3 )
[sub_resource type="Curve" id=4]
_data = [ Vector2( 0, 1 ), 0.0, 0.0, 0, 0, Vector2( 1, 0.1 ), 0.0, 0.0, 0, 0 ]
[sub_resource type="CurveTexture" id=5]
curve = SubResource( 4 )
[sub_resource type="DynamicFont" id=6]
size = 10
font_data = ExtResource( 3 )
[sub_resource type="DynamicFont" id=7]
size = 10
font_data = ExtResource( 3 )
[sub_resource type="DynamicFont" id=8]
size = 10
font_data = ExtResource( 3 )
[sub_resource type="DynamicFont" id=9]
size = 10
font_data = ExtResource( 3 )
[node name="UI" type="Node2D"]
[node name="ItemBackground" type="ColorRect" parent="."]
anchor_right = 0.058
margin_left = 8.0
margin_top = 224.0
margin_right = 120.0
margin_bottom = 384.0
color = Color( 0.403922, 0.403922, 0.403922, 1 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="LevelBackground" type="ColorRect" parent="."]
margin_left = 16.0
margin_top = 32.0
margin_right = 120.0
margin_bottom = 56.0
color = Color( 0.403922, 0.403922, 0.403922, 1 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="LevelLabel" type="Label" parent="LevelBackground"]
margin_right = 104.0
margin_bottom = 24.0
custom_fonts/font = SubResource( 1 )
text = "魔塔 第01层"
align = 1
valign = 1
__meta__ = {
"_edit_use_anchors_": false
}
[node name="WeaponBackground" type="ColorRect" parent="."]
margin_left = 552.0
margin_top = 32.0
margin_right = 656.0
margin_bottom = 72.0
color = Color( 0.403922, 0.403922, 0.403922, 1 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="WeaponLabel" type="Label" parent="WeaponBackground"]
margin_left = 8.0
margin_right = 56.0
margin_bottom = 40.0
custom_fonts/font = SubResource( 2 )
custom_colors/font_color = Color( 0.952941, 0.776471, 0.658824, 1 )
text = "神圣剑"
align = 1
valign = 1
__meta__ = {
"_edit_use_anchors_": false
}
[node name="WeaponSprite" type="Sprite" parent="WeaponBackground"]
position = Vector2( 80, 20 )
texture = ExtResource( 2 )
region_enabled = true
region_rect = Rect2( 224, 448, 32, 32 )
[node name="ShieldBackground" type="ColorRect" parent="."]
margin_left = 552.0
margin_top = 88.0
margin_right = 656.0
margin_bottom = 128.0
color = Color( 0.403922, 0.403922, 0.403922, 1 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="ShieldLabel" type="Label" parent="ShieldBackground"]
margin_left = 8.0
margin_right = 56.0
margin_bottom = 40.0
custom_fonts/font = SubResource( 2 )
custom_colors/font_color = Color( 0.815686, 0.803922, 0.992157, 1 )
text = "神圣盾"
align = 1
valign = 1
__meta__ = {
"_edit_use_anchors_": false
}
[node name="ShieldSprite" type="Sprite" parent="ShieldBackground"]
position = Vector2( 80, 20 )
texture = ExtResource( 2 )
region_enabled = true
region_rect = Rect2( 256, 448, 32, 32 )
[node name="KeyBackground" type="ColorRect" parent="."]
margin_left = 552.0
margin_top = 144.0
margin_right = 656.0
margin_bottom = 224.0
color = Color( 0.403922, 0.403922, 0.403922, 1 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="Sprite" type="Sprite" parent="KeyBackground"]
position = Vector2( 15, 26 )
scale = Vector2( 0.75, 0.75 )
texture = ExtResource( 2 )
region_enabled = true
region_rect = Rect2( 96, 448, 32, 32 )
[node name="YellowKeyCountLabel" type="Label" parent="KeyBackground"]
margin_left = 28.0
margin_top = 14.0
margin_right = 52.0
margin_bottom = 38.0
custom_fonts/font = SubResource( 3 )
text = "0"
valign = 1
autowrap = true
clip_text = true
__meta__ = {
"_edit_use_anchors_": false
}
[node name="Sprite2" type="Sprite" parent="KeyBackground"]
position = Vector2( 64, 26 )
scale = Vector2( 0.75, 0.75 )
texture = ExtResource( 2 )
region_enabled = true
region_rect = Rect2( 128, 448, 32, 32 )
[node name="BlueKeyCountLabel" type="Label" parent="KeyBackground"]
margin_left = 76.0
margin_top = 14.0
margin_right = 100.0
margin_bottom = 38.0
custom_fonts/font = SubResource( 3 )
text = "0"
valign = 1
autowrap = true
clip_text = true
__meta__ = {
"_edit_use_anchors_": false
}
[node name="Sprite3" type="Sprite" parent="KeyBackground"]
position = Vector2( 15, 60 )
scale = Vector2( 0.75, 0.75 )
texture = ExtResource( 2 )
region_enabled = true
region_rect = Rect2( 160, 448, 32, 32 )
[node name="RedKeyCountLabel" type="Label" parent="KeyBackground"]
margin_left = 27.0
margin_top = 48.0
margin_right = 51.0
margin_bottom = 72.0
custom_fonts/font = SubResource( 3 )
text = "0"
valign = 1
autowrap = true
clip_text = true
__meta__ = {
"_edit_use_anchors_": false
}
[node name="Sprite4" type="Sprite" parent="KeyBackground"]
position = Vector2( 66, 60 )
scale = Vector2( 0.75, 0.75 )
texture = ExtResource( 2 )
region_enabled = true
region_rect = Rect2( 192, 448, 32, 32 )
[node name="GreenKeyCountLabel" type="Label" parent="KeyBackground"]
margin_left = 78.0
margin_top = 48.0
margin_right = 102.0
margin_bottom = 72.0
custom_fonts/font = SubResource( 3 )
text = "0"
valign = 1
autowrap = true
clip_text = true
__meta__ = {
"_edit_use_anchors_": false
}
[node name="MonsterInfoBackground" type="ColorRect" parent="."]
margin_left = 552.0
margin_top = 240.0
margin_right = 656.0
margin_bottom = 384.0
color = Color( 0.403922, 0.403922, 0.403922, 1 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="MoneySprite" type="Sprite" parent="."]
position = Vector2( 24, 184 )
texture = ExtResource( 2 )
normal_map = SubResource( 5 )
region_enabled = true
region_rect = Rect2( 96, 480, 32, 32 )
[node name="MoneyBackground" type="ColorRect" parent="MoneySprite"]
margin_left = 24.0
margin_top = -8.0
margin_right = 96.0
margin_bottom = 8.0
color = Color( 0.403922, 0.403922, 0.403922, 1 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="MoneyLabel" type="Label" parent="MoneySprite/MoneyBackground"]
margin_right = 72.0
margin_bottom = 16.0
custom_fonts/font = SubResource( 6 )
text = "0"
align = 2
valign = 1
__meta__ = {
"_edit_use_anchors_": false
}
[node name="DefSprite" type="Sprite" parent="."]
position = Vector2( 24, 152 )
texture = ExtResource( 2 )
region_enabled = true
region_rect = Rect2( 192, 416, 32, 32 )
[node name="DefBackground" type="ColorRect" parent="DefSprite"]
margin_left = 24.0
margin_top = -8.0
margin_right = 96.0
margin_bottom = 8.0
color = Color( 0.403922, 0.403922, 0.403922, 1 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="DefLabel" type="Label" parent="DefSprite/DefBackground"]
margin_right = 72.0
margin_bottom = 16.0
custom_fonts/font = SubResource( 7 )
text = "10"
align = 2
valign = 1
__meta__ = {
"_edit_use_anchors_": false
}
[node name="AtkSprite" type="Sprite" parent="."]
position = Vector2( 24, 120 )
texture = ExtResource( 2 )
region_enabled = true
region_rect = Rect2( 192, 384, 32, 32 )
[node name="AtkBackground" type="ColorRect" parent="AtkSprite"]
margin_left = 24.0
margin_top = -8.0
margin_right = 96.0
margin_bottom = 8.0
color = Color( 0.403922, 0.403922, 0.403922, 1 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="AtkLabel" type="Label" parent="AtkSprite/AtkBackground"]
margin_right = 72.0
margin_bottom = 16.0
custom_fonts/font = SubResource( 8 )
text = "10"
align = 2
valign = 1
__meta__ = {
"_edit_use_anchors_": false
}
[node name="HpSprite" type="Sprite" parent="."]
position = Vector2( 24, 88 )
texture = ExtResource( 2 )
region_enabled = true
region_rect = Rect2( 96, 416, 32, 32 )
[node name="HpBackground" type="ColorRect" parent="HpSprite"]
margin_left = 24.0
margin_top = -8.0
margin_right = 96.0
margin_bottom = 8.0
color = Color( 0.403922, 0.403922, 0.403922, 1 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="HpLabel" type="Label" parent="HpSprite/HpBackground"]
margin_right = 72.0
margin_bottom = 16.0
custom_fonts/font = SubResource( 9 )
text = "1000"
align = 2
valign = 1
__meta__ = {
"_edit_use_anchors_": false
}

48
scripts/ArrayTween.gd Normal file
View File

@ -0,0 +1,48 @@
extends Tween
class_name ArrayTween
var index = 0
var values : Array
# 单个节点动画时间
export var duration: float = 1.0
# 动画步进回调
signal array_value_step(step)
# 所有节点动画播放完成
signal array_completed
func _ready():
connect("tween_completed",self,"on_tween_completed")
pass
# 使用节点进行动画
func interpolate_array(values:Array) -> void:
if values.size() < 2:
return
if is_active():
stop_all()
self.index = 0
self.values = values
play_step()
# 播放其中一节
func play_step():
var start_value = values[index]
var end_value = values[index + 1]
self.interpolate_method(self,"on_step",start_value,end_value,duration)
self.start()
# 程序内步进回调
func on_step(step):
emit_signal("array_value_step",step)
pass
# 动画完成回调
func on_tween_completed(object: Object, key: NodePath):
if index + 2 < values.size():
index += 1
play_step()
else:
emit_signal("array_completed")

10
scripts/GameArchive.gd Normal file
View File

@ -0,0 +1,10 @@
extends Node
class_name GameArchive
# 创建存档时间
var create_time : String
# 更新存档时间
var update_time : String

View File

@ -0,0 +1,64 @@
tool
extends TileMap
class_name NavigationTileMap
var astar : AStar2D = AStar2D.new()
# 遮挡物
export(NodePath) var collsion_tilemap_path : NodePath
# 初始化tilemap配置
func _init():
self.tile_set = load("res://images/mota_tileset.tres")
self.cell_size = Vector2(32,32)
# 初始化node和edge
func _ready():
var cells := get_cells()
init_nodes(cells)
init_edges(cells)
# 初始化nodes
func init_nodes(cells:Array):
for index in range(cells.size()):
var cell_position = cells[index] * cell_size
cell_position.x += 16
cell_position.y += 16
astar.add_point(index, cell_position)
# 初始化edge
func init_edges(cells:Array):
for index in range(cells.size()):
var cell = cells[index]
#left
var left_cell_index = cells.find(Vector2(cell.x - 1,cell.y))
if left_cell_index != -1:
astar.connect_points(index,left_cell_index)
#right
var right_cell_index = cells.find(Vector2(cell.x + 1,cell.y))
if right_cell_index != -1:
astar.connect_points(index,right_cell_index)
#up
var up_cell_index = cells.find(Vector2(cell.x,cell.y - 1))
if up_cell_index != -1:
astar.connect_points(index,up_cell_index)
#down
var down_cell_index = cells.find(Vector2(cell.x,cell.y + 1))
if down_cell_index != -1:
astar.connect_points(index,down_cell_index)
# 返回显示的道路需要去除被遮挡的道路
func get_cells() -> Array:
var cells = get_used_cells()
if not collsion_tilemap_path.is_empty():
var collsion_tilemap = get_node(collsion_tilemap_path) as TileMap
print("collsion_tilemap ", collsion_tilemap)
var collsion_cells = collsion_tilemap.get_used_cells()
for collsion_cell in collsion_cells:
var index = cells.find(collsion_cell)
if index != -1:
print("index ",index)
print("cell ",cells[index])
cells.remove(index)
return cells

View File

@ -0,0 +1,36 @@
tool
extends KinematicBody2D
class_name PlayerKinematicBody2D
export(NodePath) var navigation_tile_map_path : NodePath
var navigation_tile_map : NavigationTileMap
onready var array_tween : ArrayTween = $ArrayTween
onready var animation_tree : AnimationTree = $AnimationTree
# 初始化导航相关数据
func _ready():
if not navigation_tile_map_path.is_empty():
navigation_tile_map = get_node(navigation_tile_map_path)
# 监听屏幕点击事件
func _input(event):
if event is InputEventMouseButton and event.is_pressed() and navigation_tile_map != null:
var astar = navigation_tile_map.astar
var start_id = astar.get_closest_point(position)
var end_id = astar.get_closest_point(event.position)
var paths = astar.get_point_path(start_id,end_id)
animation_tree.active = true
array_tween.interpolate_array(paths)
func _on_ArrayTween_array_completed():
animation_tree.active = false
func _on_ArrayTween_array_value_step(step):
var diff = step - position
animation_tree["parameters/player/blend_position"] = diff
move_and_collide(diff)
get_viewport().get_texture()

47
scripts/PlayerProperty.gd Normal file
View File

@ -0,0 +1,47 @@
extends Object
class_name PlayerProperty
# 英雄名称
var username : String = "hero"
# 英雄血量
var hp : int = 1000
# 英雄攻击力
var atk : int = 1
# 英雄防御力
var def : int = 1
#默认金钱
var money : int = 0
# 英雄等级
var level : int = 1
# 英雄经验
var experience : int = 0
# 当前楼层
var now_floor = 1
# 去过的最大楼层
var max_floor = 1
# 去过的最小楼层
var min_floor = 1
# 被使用的道具
var used_items : Dictionary = {}
# 增加使用过的道具
func add_used_item(now_floor:int,id:int) -> void:
if not used_items.has(now_floor):
used_items[now_floor] = []
var items = used_items[now_floor] as Array
items.append(id)
# 根据楼层查询被使用过的道具
func get_used_items_by_floor(query_floor:int) -> Array:
return used_items[query_floor]

12
scripts/PlayerSprite.gd Normal file
View File

@ -0,0 +1,12 @@
tool
extends Sprite
class_name PlayerSprite
# 默认数据初始化
func _init():
self.texture = load("res://images/mota.png")
self.region_enabled = true
self.region_rect = Rect2(192,192,128,96)
self.vframes = 3
self.hframes = 4

View File

@ -0,0 +1,7 @@
[gd_resource type="Environment" load_steps=2 format=2]
[sub_resource type="ProceduralSky" id=1]
[resource]
background_mode = 2
background_sky = SubResource( 1 )

BIN
settings/icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

34
settings/icon.png.import Normal file
View File

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/icon.png-63d61f13bea2972fb98d2318c1e93e56.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://settings/icon.png"
dest_files=[ "res://.import/icon.png-63d61f13bea2972fb98d2318c1e93e56.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
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0