Mob Script
This commit is contained in:
parent
f12bb7d853
commit
a8319042d0
|
|
@ -0,0 +1,13 @@
|
||||||
|
# Default ignored files
|
||||||
|
/shelf/
|
||||||
|
/workspace.xml
|
||||||
|
# Rider ignored files
|
||||||
|
/contentModel.xml
|
||||||
|
/.idea.AutoChessProject.iml
|
||||||
|
/projectSettingsUpdater.xml
|
||||||
|
/modules.xml
|
||||||
|
# Editor-based HTTP Client requests
|
||||||
|
/httpRequests/
|
||||||
|
# Datasource local storage ignored files
|
||||||
|
/dataSources/
|
||||||
|
/dataSources.local.xml
|
||||||
|
|
@ -0,0 +1,4 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="Encoding" addBOMForNewFiles="with BOM under Windows, with no BOM otherwise" />
|
||||||
|
</project>
|
||||||
|
|
@ -0,0 +1,8 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="UserContentModel">
|
||||||
|
<attachedFolders />
|
||||||
|
<explicitIncludes />
|
||||||
|
<explicitExcludes />
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
|
|
@ -0,0 +1,6 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="VcsDirectoryMappings">
|
||||||
|
<mapping directory="" vcs="Git" />
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
|
|
@ -0,0 +1,6 @@
|
||||||
|
<Project Sdk="Godot.NET.Sdk/4.4.0">
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>net8.0</TargetFramework>
|
||||||
|
<EnableDynamicLoading>true</EnableDynamicLoading>
|
||||||
|
</PropertyGroup>
|
||||||
|
</Project>
|
||||||
|
|
@ -0,0 +1,19 @@
|
||||||
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
|
# Visual Studio 2012
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AutoChessProject", "AutoChessProject.csproj", "{3F6AA5CD-3099-4869-93AF-A40B8CB5B691}"
|
||||||
|
EndProject
|
||||||
|
Global
|
||||||
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
|
Debug|Any CPU = Debug|Any CPU
|
||||||
|
ExportDebug|Any CPU = ExportDebug|Any CPU
|
||||||
|
ExportRelease|Any CPU = ExportRelease|Any CPU
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
|
{3F6AA5CD-3099-4869-93AF-A40B8CB5B691}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{3F6AA5CD-3099-4869-93AF-A40B8CB5B691}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{3F6AA5CD-3099-4869-93AF-A40B8CB5B691}.ExportDebug|Any CPU.ActiveCfg = ExportDebug|Any CPU
|
||||||
|
{3F6AA5CD-3099-4869-93AF-A40B8CB5B691}.ExportDebug|Any CPU.Build.0 = ExportDebug|Any CPU
|
||||||
|
{3F6AA5CD-3099-4869-93AF-A40B8CB5B691}.ExportRelease|Any CPU.ActiveCfg = ExportRelease|Any CPU
|
||||||
|
{3F6AA5CD-3099-4869-93AF-A40B8CB5B691}.ExportRelease|Any CPU.Build.0 = ExportRelease|Any CPU
|
||||||
|
EndGlobalSection
|
||||||
|
EndGlobal
|
||||||
|
|
@ -1,10 +1,12 @@
|
||||||
[gd_scene load_steps=6 format=4 uid="uid://clilwruw7ln4w"]
|
[gd_scene load_steps=9 format=4 uid="uid://clilwruw7ln4w"]
|
||||||
|
|
||||||
[ext_resource type="Texture2D" uid="uid://cbioy3k1erth7" path="res://Assets/Tilemaps/Tilemap/tilemap.png" id="1_wh5rx"]
|
[ext_resource type="Texture2D" uid="uid://cbioy3k1erth7" path="res://Assets/Tilemaps/Tilemap/tilemap.png" id="1_8871w"]
|
||||||
[ext_resource type="Texture2D" uid="uid://blpkbnd2ginn0" path="res://Assets/Tilemaps/Tiles/tile_0084.png" id="2_pjbty"]
|
[ext_resource type="Script" uid="uid://dtco6yt3nhgrp" path="res://Scripts/Mob.cs" id="2_tsg1g"]
|
||||||
|
[ext_resource type="Texture2D" uid="uid://blpkbnd2ginn0" path="res://Assets/Tilemaps/Tiles/tile_0084.png" id="3_vd8ro"]
|
||||||
|
[ext_resource type="Texture2D" uid="uid://bdhcy1gn7fnhp" path="res://Assets/Tilemaps/Tiles/tile_0121.png" id="4_lcu17"]
|
||||||
|
|
||||||
[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_pjbty"]
|
[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_pjbty"]
|
||||||
texture = ExtResource("1_wh5rx")
|
texture = ExtResource("1_8871w")
|
||||||
separation = Vector2i(1, 1)
|
separation = Vector2i(1, 1)
|
||||||
0:0/0 = 0
|
0:0/0 = 0
|
||||||
1:0/0 = 0
|
1:0/0 = 0
|
||||||
|
|
@ -145,7 +147,11 @@ sources/0 = SubResource("TileSetAtlasSource_pjbty")
|
||||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_fqbyx"]
|
[sub_resource type="RectangleShape2D" id="RectangleShape2D_fqbyx"]
|
||||||
size = Vector2(16, 16)
|
size = Vector2(16, 16)
|
||||||
|
|
||||||
|
[sub_resource type="RectangleShape2D" id="RectangleShape2D_vuqrp"]
|
||||||
|
size = Vector2(16, 16)
|
||||||
|
|
||||||
[node name="Node2D" type="Node2D"]
|
[node name="Node2D" type="Node2D"]
|
||||||
|
scale = Vector2(4, 4)
|
||||||
|
|
||||||
[node name="TileMap" type="TileMap" parent="."]
|
[node name="TileMap" type="TileMap" parent="."]
|
||||||
tile_set = SubResource("TileSet_fqbyx")
|
tile_set = SubResource("TileSet_fqbyx")
|
||||||
|
|
@ -158,11 +164,31 @@ tile_set = SubResource("TileSet_fqbyx")
|
||||||
|
|
||||||
[node name="Mob" type="CharacterBody2D" parent="."]
|
[node name="Mob" type="CharacterBody2D" parent="."]
|
||||||
position = Vector2(168, 104)
|
position = Vector2(168, 104)
|
||||||
|
script = ExtResource("2_tsg1g")
|
||||||
|
|
||||||
[node name="Sprite2D" type="Sprite2D" parent="Mob"]
|
[node name="Sprite2D" type="Sprite2D" parent="Mob"]
|
||||||
texture = ExtResource("2_pjbty")
|
texture = ExtResource("3_vd8ro")
|
||||||
metadata/_edit_lock_ = true
|
metadata/_edit_lock_ = true
|
||||||
|
|
||||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="Mob"]
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="Mob"]
|
||||||
shape = SubResource("RectangleShape2D_fqbyx")
|
shape = SubResource("RectangleShape2D_fqbyx")
|
||||||
metadata/_edit_lock_ = true
|
metadata/_edit_lock_ = true
|
||||||
|
|
||||||
|
[node name="Navigation" type="Node2D" parent="Mob"]
|
||||||
|
|
||||||
|
[node name="NavigationAgent2D" type="NavigationAgent2D" parent="Mob/Navigation"]
|
||||||
|
|
||||||
|
[node name="Timer" type="Timer" parent="Mob/Navigation"]
|
||||||
|
wait_time = 0.1
|
||||||
|
autostart = true
|
||||||
|
|
||||||
|
[node name="TargetMob" type="CharacterBody2D" parent="."]
|
||||||
|
position = Vector2(232, 184)
|
||||||
|
|
||||||
|
[node name="Sprite2D" type="Sprite2D" parent="TargetMob"]
|
||||||
|
texture = ExtResource("4_lcu17")
|
||||||
|
metadata/_edit_lock_ = true
|
||||||
|
|
||||||
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="TargetMob"]
|
||||||
|
shape = SubResource("RectangleShape2D_vuqrp")
|
||||||
|
metadata/_edit_lock_ = true
|
||||||
|
|
@ -0,0 +1,21 @@
|
||||||
|
using Godot;
|
||||||
|
using System;
|
||||||
|
|
||||||
|
public partial class Mob : CharacterBody2D
|
||||||
|
{
|
||||||
|
|
||||||
|
[Export]
|
||||||
|
public CharacterBody2D target = null;
|
||||||
|
|
||||||
|
public int speed = 100;
|
||||||
|
public NavigationAgent2D navAgent;
|
||||||
|
public override void _Ready()
|
||||||
|
{
|
||||||
|
navAgent = GetNode<NavigationAgent2D>("Navigation/NavigationAgent2D");
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void _Process(double delta)
|
||||||
|
{
|
||||||
|
this.MoveLocalX(0.5f);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
uid://dtco6yt3nhgrp
|
||||||
|
|
@ -11,7 +11,8 @@ config_version=5
|
||||||
[application]
|
[application]
|
||||||
|
|
||||||
config/name="AutoChessProject"
|
config/name="AutoChessProject"
|
||||||
config/features=PackedStringArray("4.4", "Mobile")
|
run/main_scene="uid://clilwruw7ln4w"
|
||||||
|
config/features=PackedStringArray("4.4", "C#", "Mobile")
|
||||||
config/icon="uid://dtfbcvhcdhgl0"
|
config/icon="uid://dtfbcvhcdhgl0"
|
||||||
|
|
||||||
[display]
|
[display]
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue