Compare commits

...

3 Commits

Author SHA1 Message Date
Patrick 1f5149e634 Added tile based movement 2025-04-15 18:50:18 +02:00
Patrick e58d6ea0be added .idea gitignore and vcs relevant files 2025-04-15 18:40:36 +02:00
Patrick f5423799d9 Added Jetbrains and C# gitignore 2025-04-15 18:40:36 +02:00
12 changed files with 763 additions and 19 deletions

569
.gitignore vendored
View File

@ -12,4 +12,571 @@ export_credentials.cfg
# Mono-specific ignores
.mono/
data_*/
mono_crash.*.json
mono_crash.*.json
## RedirectedFrom: https://github.com/sch-seiryu/SharpenTheCSharp/blob/main/.gitignore
##
## From 'Jetbrains.gitignore'
## URL: https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
## # Related issue: https://rider-support.jetbrains.com/hc/en-us/articles/207097529-What-is-the-idea-folder-
## Note that following three files are excluded: 'indexLayout.xml', 'vcs.xml', and 'runConfigurations'
## Pasted the snippet below:
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
# User-specific stuff
.idea/**/workspace.xml
.idea/**/tasks.xml
.idea/**/usage.statistics.xml
.idea/**/dictionaries
.idea/**/shelf
# AWS User-specific
.idea/**/aws.xml
# Generated files
.idea/**/contentModel.xml
# Sensitive or high-churn files
.idea/**/dataSources/
.idea/**/dataSources.ids
.idea/**/dataSources.local.xml
.idea/**/sqlDataSources.xml
.idea/**/dynamic.xml
.idea/**/uiDesigner.xml
.idea/**/dbnavigator.xml
# Gradle
.idea/**/gradle.xml
.idea/**/libraries
# Gradle and Maven with auto-import
# When using Gradle or Maven with auto-import, you should exclude module files,
# since they will be recreated, and may cause churn. Uncomment if using
# auto-import.
# .idea/artifacts
# .idea/compiler.xml
# .idea/jarRepositories.xml
# .idea/modules.xml
# .idea/*.iml
# .idea/modules
# *.iml
# *.ipr
# CMake
cmake-build-*/
# Mongo Explorer plugin
.idea/**/mongoSettings.xml
# File-based project format
*.iws
# IntelliJ
out/
# mpeltonen/sbt-idea plugin
.idea_modules/
# JIRA plugin
atlassian-ide-plugin.xml
# Cursive Clojure plugin
.idea/replstate.xml
# SonarLint plugin
.idea/sonarlint/
# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties
# Editor-based Rest Client
.idea/httpRequests
# Android studio 3.1+ serialized cache file
.idea/caches/build_file_checksums.ser
## [gitignore covers JetBrains IDEs above]
##
## [dotnet generated gitignore below]
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
##
## Get latest from https://github.com/github/gitignore/blob/main/VisualStudio.gitignore
# User-specific files
*.rsuser
*.suo
*.user
*.userosscache
*.sln.docstates
# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs
# Mono auto generated files
mono_crash.*
# Build results
[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
x64/
x86/
[Ww][Ii][Nn]32/
[Aa][Rr][Mm]/
[Aa][Rr][Mm]64/
bld/
[Bb]in/
[Oo]bj/
[Ll]og/
[Ll]ogs/
# Visual Studio 2015/2017 cache/options directory
.vs/
# Uncomment if you have tasks that create the project's static files in wwwroot
#wwwroot/
# Visual Studio 2017 auto generated files
Generated\ Files/
# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*
# NUnit
*.VisualState.xml
TestResult.xml
nunit-*.xml
# Build Results of an ATL Project
[Dd]ebugPS/
[Rr]eleasePS/
dlldata.c
# Benchmark Results
BenchmarkDotNet.Artifacts/
# .NET
project.lock.json
project.fragment.lock.json
artifacts/
# Tye
.tye/
# ASP.NET Scaffolding
ScaffoldingReadMe.txt
# StyleCop
StyleCopReport.xml
# Files built by Visual Studio
*_i.c
*_p.c
*_h.h
*.ilk
*.meta
*.obj
*.iobj
*.pch
*.pdb
*.ipdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.tmp_proj
*_wpftmp.csproj
*.log
*.tlog
*.vspscc
*.vssscc
.builds
*.pidb
*.svclog
*.scc
# Chutzpah Test files
_Chutzpah*
# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opendb
*.opensdf
*.sdf
*.cachefile
*.VC.db
*.VC.VC.opendb
# Visual Studio profiler
*.psess
*.vsp
*.vspx
*.sap
# Visual Studio Trace Files
*.e2e
# TFS 2012 Local Workspace
$tf/
# Guidance Automation Toolkit
*.gpState
# ReSharper is a .NET coding add-in
_ReSharper*/
*.[Rr]e[Ss]harper
*.DotSettings.user
# TeamCity is a build add-in
_TeamCity*
# DotCover is a Code Coverage Tool
*.dotCover
# AxoCover is a Code Coverage Tool
.axoCover/*
!.axoCover/settings.json
# Coverlet is a free, cross platform Code Coverage Tool
coverage*.json
coverage*.xml
coverage*.info
# Visual Studio code coverage results
*.coverage
*.coveragexml
# NCrunch
_NCrunch_*
.*crunch*.local.xml
nCrunchTemp_*
# MightyMoose
*.mm.*
AutoTest.Net/
# Web workbench (sass)
.sass-cache/
# Installshield output folder
[Ee]xpress/
# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
DocProject/Help/*.HxC
DocProject/Help/*.hhc
DocProject/Help/*.hhk
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html
# Click-Once directory
publish/
# Publish Web Output
*.[Pp]ublish.xml
*.azurePubxml
# Note: Comment the next line if you want to checkin your web deploy settings,
# but database connection strings (with potential passwords) will be unencrypted
*.pubxml
*.publishproj
# Microsoft Azure Web App publish settings. Comment the next line if you want to
# checkin your Azure Web App publish settings, but sensitive information contained
# in these scripts will be unencrypted
PublishScripts/
# NuGet Packages
*.nupkg
# NuGet Symbol Packages
*.snupkg
# The packages folder can be ignored because of Package Restore
**/[Pp]ackages/*
# except build/, which is used as an MSBuild target.
!**/[Pp]ackages/build/
# Uncomment if necessary however generally it will be regenerated when needed
#!**/[Pp]ackages/repositories.config
# NuGet v3's project.json files produces more ignorable files
*.nuget.props
*.nuget.targets
# Microsoft Azure Build Output
csx/
*.build.csdef
# Microsoft Azure Emulator
ecf/
rcf/
# Windows Store app package directories and files
AppPackages/
BundleArtifacts/
Package.StoreAssociation.xml
_pkginfo.txt
*.appx
*.appxbundle
*.appxupload
# Visual Studio cache files
# files ending in .cache can be ignored
*.[Cc]ache
# but keep track of directories ending in .cache
!?*.[Cc]ache/
# Others
ClientBin/
~$*
*~
*.dbmdl
*.dbproj.schemaview
*.jfm
*.pfx
*.publishsettings
orleans.codegen.cs
# Including strong name files can present a security risk
# (https://github.com/github/gitignore/pull/2483#issue-259490424)
#*.snk
# Since there are multiple workflows, uncomment next line to ignore bower_components
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
#bower_components/
# RIA/Silverlight projects
Generated_Code/
# Backup & report files from converting an old project file
# to a newer Visual Studio version. Backup files are not needed,
# because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
UpgradeLog*.htm
ServiceFabricBackup/
*.rptproj.bak
# SQL Server files
*.mdf
*.ldf
*.ndf
# Business Intelligence projects
*.rdl.data
*.bim.layout
*.bim_*.settings
*.rptproj.rsuser
*- [Bb]ackup.rdl
*- [Bb]ackup ([0-9]).rdl
*- [Bb]ackup ([0-9][0-9]).rdl
# Microsoft Fakes
FakesAssemblies/
# GhostDoc plugin setting file
*.GhostDoc.xml
# Node.js Tools for Visual Studio
.ntvs_analysis.dat
node_modules/
# Visual Studio 6 build log
*.plg
# Visual Studio 6 workspace options file
*.opt
# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
*.vbw
# Visual Studio 6 auto-generated project file (contains which files were open etc.)
*.vbp
# Visual Studio 6 workspace and project file (working project files containing files to include in project)
*.dsw
*.dsp
# Visual Studio 6 technical files
*.ncb
*.aps
# Visual Studio LightSwitch build output
**/*.HTMLClient/GeneratedArtifacts
**/*.DesktopClient/GeneratedArtifacts
**/*.DesktopClient/ModelManifest.xml
**/*.Server/GeneratedArtifacts
**/*.Server/ModelManifest.xml
_Pvt_Extensions
# Paket dependency manager
.paket/paket.exe
paket-files/
# FAKE - F# Make
.fake/
# CodeRush personal settings
.cr/personal
# Python Tools for Visual Studio (PTVS)
__pycache__/
*.pyc
# Cake - Uncomment if you are using it
# tools/**
# !tools/packages.config
# Tabs Studio
*.tss
# Telerik's JustMock configuration file
*.jmconfig
# BizTalk build output
*.btp.cs
*.btm.cs
*.odx.cs
*.xsd.cs
# OpenCover UI analysis results
OpenCover/
# Azure Stream Analytics local run output
ASALocalRun/
# MSBuild Binary and Structured Log
*.binlog
# NVidia Nsight GPU debugger configuration file
*.nvuser
# MFractors (Xamarin productivity tool) working folder
.mfractor/
# Local History for Visual Studio
.localhistory/
# Visual Studio History (VSHistory) files
.vshistory/
# BeatPulse healthcheck temp database
healthchecksdb
# Backup folder for Package Reference Convert tool in Visual Studio 2017
MigrationBackup/
# Ionide (cross platform F# VS Code tools) working folder
.ionide/
# Fody - auto-generated XML schema
FodyWeavers.xsd
# VS Code files for those working on multiple tools
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
*.code-workspace
# Local History for Visual Studio Code
.history/
# Windows Installer files from build outputs
*.cab
*.msi
*.msix
*.msm
*.msp
# JetBrains Rider
*.sln.iml
##
## Visual studio for Mac
##
# globs
Makefile.in
*.userprefs
*.usertasks
config.make
config.status
aclocal.m4
install-sh
autom4te.cache/
*.tar.gz
tarballs/
test-results/
# Mac bundle stuff
*.dmg
*.app
# content below from: https://github.com/github/gitignore/blob/master/Global/macOS.gitignore
# General
.DS_Store
.AppleDouble
.LSOverride
# Icon must end with two \r
Icon
# Thumbnails
._*
# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent
# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk
# content below from: https://github.com/github/gitignore/blob/master/Global/Windows.gitignore
# Windows thumbnail cache files
Thumbs.db
ehthumbs.db
ehthumbs_vista.db
# Dump file
*.stackdump
# Folder config file
[Dd]esktop.ini
# Recycle Bin used on file shares
$RECYCLE.BIN/
# Windows Installer files
*.cab
*.msi
*.msix
*.msm
*.msp
# Windows shortcuts
*.lnk

13
.idea/.gitignore vendored Normal file
View File

@ -0,0 +1,13 @@
# Default ignored files
/shelf/
/workspace.xml
# Rider ignored files
/.idea.AutoChessGame.iml
**/modules.xml
**/projectSettingsUpdater.xml
**/contentModel.xml
# Editor-based HTTP Client requests
/httpRequests/
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml

View File

@ -0,0 +1 @@
AutoChessProject

8
.idea/indexLayout.xml Normal file
View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="UserContentModel">
<attachedFolders />
<explicitIncludes />
<explicitExcludes />
</component>
</project>

6
.idea/vcs.xml Normal file
View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="Git" />
</component>
</project>

View File

@ -0,0 +1,53 @@
using Godot;
public partial class RemotePathFollow2D : Path2D
{
[Export] public Node2D Target { get; set; } = null;
[Export] public double Speed { get; set; } = 1;
public bool Started => _started;
public bool Finished => _pathFollowNode.ProgressRatio >= 1;
private PathFollow2D _pathFollowNode = new PathFollow2D();
private bool _started = true;
private Vector2 _startingPosition;
public RemotePathFollow2D() { }
public RemotePathFollow2D(Node2D target) => Target = target;
public RemotePathFollow2D(float speed) => Speed = speed;
public RemotePathFollow2D(Node2D target, float speed) => (Target, Speed) = (target, speed);
public override void _Ready()
{
base._Ready();
_pathFollowNode.Loop = false;
_pathFollowNode.CubicInterp = false;
AddChild(_pathFollowNode);
}
public override void _Process(double delta)
{
base._Process(delta);
}
public override void _PhysicsProcess(double delta)
{
base._Process(delta);
if (Started)
{
_pathFollowNode.Progress += (float)(Speed * delta);
Target.Position = _startingPosition + _pathFollowNode.Position;
}
}
public void Start()
{
_startingPosition = Target.Position;
_started = true;
}
}

View File

@ -0,0 +1 @@
uid://n8kpn7lhard2

View File

@ -1,7 +1,8 @@
[gd_scene load_steps=9 format=4 uid="uid://clilwruw7ln4w"]
[gd_scene load_steps=10 format=4 uid="uid://clilwruw7ln4w"]
[ext_resource type="Texture2D" uid="uid://cbioy3k1erth7" path="res://Assets/Tilemaps/Tilemap/tilemap.png" id="1_8871w"]
[ext_resource type="Script" uid="uid://dtco6yt3nhgrp" path="res://Scripts/Mob.cs" id="2_tsg1g"]
[ext_resource type="Script" uid="uid://rmyjvxdhcw4r" path="res://Scripts/Floor.cs" id="2_vd8ro"]
[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"]
@ -153,42 +154,43 @@ size = Vector2(16, 16)
[node name="Node2D" type="Node2D"]
scale = Vector2(4, 4)
[node name="TileMap" type="TileMap" parent="."]
tile_set = SubResource("TileSet_fqbyx")
format = 2
[node name="Floor" type="TileMapLayer" parent="TileMap"]
[node name="Floor" type="TileMapLayer" parent="." node_paths=PackedStringArray("MovementTarget")]
use_parent_material = true
tile_map_data = PackedByteArray("AAAHAAQAAAAAAAAAAAAIAAQAAAACAAQAAAAJAAQAAAAAAAAAAAAKAAQAAAACAAQAAAALAAQAAAAAAAAAAAAMAAQAAAADAAQAAAAHAAUAAAAAAAQAAAAIAAUAAAAAAAAAAAAJAAUAAAAAAAQAAAAKAAUAAAAAAAAAAAALAAUAAAAAAAQAAAAMAAUAAAAAAAAAAAANAAQAAAAAAAAAAAAOAAQAAAAAAAQAAAAPAAQAAAAAAAAAAAAQAAQAAAAEAAQAAAANAAUAAAAAAAQAAAAOAAUAAAAAAAIAAAAPAAUAAAAAAAQAAAAQAAUAAAAAAAAAAAAQAAYAAAAAAAQAAAAQAAcAAAAAAAAAAAAQAAgAAAAAAAQAAAAQAAkAAAAAAAAAAAAQAAoAAAAAAAQAAAAQAAsAAAAAAAIAAAAQAAwAAAAAAAQAAAAQAA0AAAAAAAAAAAAPAA0AAAAGAAMAAAAOAA0AAAAAAAAAAAANAA0AAAAAAAQAAAAMAA0AAAAAAAAAAAALAA0AAAAAAAQAAAAKAA0AAAAAAAEAAAAJAA0AAAAAAAQAAAAIAA0AAAAAAAAAAAAHAA0AAAAAAAQAAAAHAAwAAAAAAAAAAAAHAAsAAAAAAAQAAAAHAAoAAAAAAAAAAAAHAAkAAAAAAAQAAAAHAAgAAAAAAAAAAAAHAAcAAAAFAAQAAAAHAAYAAAAAAAAAAAAIAAYAAAAAAAQAAAAJAAYAAAAAAAEAAAAKAAYAAAAAAAQAAAALAAYAAAAAAAAAAAAMAAYAAAAAAAQAAAANAAYAAAAAAAAAAAAOAAYAAAAAAAQAAAAPAAYAAAAAAAAAAAAPAAcAAAAAAAQAAAAPAAgAAAAAAAAAAAAPAAkAAAAAAAQAAAAPAAoAAAAAAAAAAAAPAAsAAAAAAAQAAAAPAAwAAAAAAAAAAAAOAAwAAAAAAAQAAAANAAwAAAAAAAAAAAAMAAwAAAAAAAQAAAALAAwAAAAAAAAAAAAKAAwAAAABAAQAAAAJAAwAAAAAAAAAAAAIAAwAAAAAAAQAAAAIAAsAAAAAAAAAAAAIAAoAAAABAAQAAAAIAAkAAAAAAAAAAAAIAAgAAAAAAAQAAAAIAAcAAAAAAAAAAAAJAAcAAAAAAAQAAAAKAAcAAAAAAAAAAAALAAcAAAAAAAQAAAAMAAcAAAAAAAAAAAANAAcAAAABAAQAAAAOAAcAAAAAAAAAAAAOAAgAAAAAAAQAAAAOAAkAAAAAAAAAAAAOAAoAAAABAAQAAAAOAAsAAAAAAAAAAAANAAsAAAABAAQAAAAMAAsAAAAAAAAAAAALAAsAAAAAAAQAAAAKAAsAAAAAAAAAAAAJAAsAAAAAAAQAAAAJAAoAAAAAAAAAAAAJAAkAAAABAAQAAAAKAAkAAAAAAAAAAAALAAkAAAAAAAQAAAAMAAkAAAAAAAAAAAANAAkAAAAAAAQAAAANAAoAAAAAAAIAAAAMAAoAAAAAAAQAAAALAAoAAAAAAAAAAAAKAAoAAAAAAAQAAAAJAAgAAAAAAAAAAAAKAAgAAAAAAAQAAAALAAgAAAAAAAAAAAAMAAgAAAAAAAQAAAANAAgAAAAAAAAAAAA=")
tile_set = SubResource("TileSet_fqbyx")
script = ExtResource("2_vd8ro")
MovementTarget = NodePath("Mob")
MovementSpeed = 20.0
[node name="Mob" type="CharacterBody2D" parent="."]
position = Vector2(168, 104)
[node name="Mob" type="CharacterBody2D" parent="Floor"]
position = Vector2(167.75, 103.75)
script = ExtResource("2_tsg1g")
[node name="Sprite2D" type="Sprite2D" parent="Mob"]
[node name="Sprite2D" type="Sprite2D" parent="Floor/Mob"]
texture = ExtResource("3_vd8ro")
metadata/_edit_lock_ = true
[node name="CollisionShape2D" type="CollisionShape2D" parent="Mob"]
[node name="CollisionShape2D" type="CollisionShape2D" parent="Floor/Mob"]
shape = SubResource("RectangleShape2D_fqbyx")
metadata/_edit_lock_ = true
[node name="Navigation" type="Node2D" parent="Mob"]
[node name="Navigation" type="Node2D" parent="Floor/Mob"]
[node name="NavigationAgent2D" type="NavigationAgent2D" parent="Mob/Navigation"]
[node name="NavigationAgent2D" type="NavigationAgent2D" parent="Floor/Mob/Navigation"]
[node name="Timer" type="Timer" parent="Mob/Navigation"]
[node name="Timer" type="Timer" parent="Floor/Mob/Navigation"]
wait_time = 0.1
autostart = true
[node name="TargetMob" type="CharacterBody2D" parent="."]
[node name="TargetMob" type="CharacterBody2D" parent="Floor"]
position = Vector2(232, 184)
[node name="Sprite2D" type="Sprite2D" parent="TargetMob"]
[node name="Sprite2D" type="Sprite2D" parent="Floor/TargetMob"]
texture = ExtResource("4_lcu17")
metadata/_edit_lock_ = true
[node name="CollisionShape2D" type="CollisionShape2D" parent="TargetMob"]
[node name="CollisionShape2D" type="CollisionShape2D" parent="Floor/TargetMob"]
shape = SubResource("RectangleShape2D_vuqrp")
metadata/_edit_lock_ = true
[connection signal="RequestMovement" from="Floor/Mob" to="Floor" method="_on_mob_request_movement"]

65
Scripts/Floor.cs Normal file
View File

@ -0,0 +1,65 @@
using Godot;
using Godot.Collections;
public partial class Floor : TileMapLayer
{
[Export] public Mob MovementTarget { get; set; }
[Export] public float MovementSpeed { get; set; }
private RemotePathFollow2D _movementPathNode = null;
private AStarGrid2D _directionFinder;
public override void _Ready()
{
base._Ready();
MovementTarget.RequestMovement += _HandleMoveRequest;
_directionFinder = new AStarGrid2D();
_directionFinder.Region = GetUsedRect();
_directionFinder.Update();
Array<Vector2I> path = _directionFinder.GetIdPath(GetUsedRect().Position, GetUsedRect().Position + new Vector2I(5, 3));
Line2D line = new Line2D();
line.ZIndex = 5;
foreach (Vector2I point in path)
{
line.AddPoint(MapToLocal(point));
}
//AddChild(line);
}
public override void _Process(double delta)
{
base._Process(delta);
if (_movementPathNode is { Finished: true })
{
_movementPathNode.QueueFree();
_movementPathNode = null;
}
}
private void _HandleMoveRequest(Vector2I direction)
{
if (direction == Vector2I.Zero || _movementPathNode != null)
{
return;
}
_movementPathNode = new RemotePathFollow2D(MovementTarget, MovementSpeed);
_movementPathNode.Curve = _curveToPoint(MapToLocal(direction) - MapToLocal(Vector2I.Zero));
_movementPathNode.Start();
AddChild(_movementPathNode);
}
private Curve2D _curveToPoint(Vector2 point)
{
Curve2D curve = new Curve2D();
curve.AddPoint(Vector2.Zero);
curve.AddPoint(point);
return curve;
}
}

1
Scripts/Floor.cs.uid Normal file
View File

@ -0,0 +1 @@
uid://rmyjvxdhcw4r

View File

@ -1,14 +1,17 @@
using Godot;
using System;
public partial class Mob : CharacterBody2D
{
[Signal]
public delegate void RequestMovementEventHandler(Vector2I direction);
[Export]
public CharacterBody2D target = null;
public int speed = 100;
public NavigationAgent2D navAgent;
public override void _Ready()
{
navAgent = GetNode<NavigationAgent2D>("Navigation/NavigationAgent2D");
@ -16,6 +19,7 @@ public partial class Mob : CharacterBody2D
public override void _Process(double delta)
{
this.MoveLocalX(0.5f);
Vector2 direction = Input.GetVector("left","right", "up", "down");
EmitSignalRequestMovement(new Vector2I((int)direction.X, (int)direction.Y));
}
}

View File

@ -24,6 +24,29 @@ window/size/viewport_height=1080
project/assembly_name="AutoChessProject"
[input]
left={
"deadzone": 0.2,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194319,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
]
}
right={
"deadzone": 0.2,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194321,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
]
}
up={
"deadzone": 0.2,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194320,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
]
}
down={
"deadzone": 0.2,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194322,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
]
}
[rendering]
textures/canvas_textures/default_texture_filter=0