Basic player & enemy movement.
This commit is contained in:
Generated
+15
@@ -0,0 +1,15 @@
|
||||
# Default ignored files
|
||||
/shelf/
|
||||
/workspace.xml
|
||||
# Rider ignored files
|
||||
/modules.xml
|
||||
/projectSettingsUpdater.xml
|
||||
/contentModel.xml
|
||||
/.idea.fgj26.iml
|
||||
# Ignored default folder with query files
|
||||
/queries/
|
||||
# Datasource local storage ignored files
|
||||
/dataSources/
|
||||
/dataSources.local.xml
|
||||
# Editor-based HTTP Client requests
|
||||
/httpRequests/
|
||||
Generated
+1
@@ -0,0 +1 @@
|
||||
fgj26
|
||||
Generated
+4
@@ -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>
|
||||
Generated
+8
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="UserContentModel">
|
||||
<attachedFolders />
|
||||
<explicitIncludes />
|
||||
<explicitExcludes />
|
||||
</component>
|
||||
</project>
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
<component name="libraryTable">
|
||||
<library name="GdSdk" type="GdScript">
|
||||
<CLASSES />
|
||||
<JAVADOC />
|
||||
<SOURCES>
|
||||
<root url="file://$APPLICATION_PLUGINS_DIR$/GdScript/extracted/Master" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
</component>
|
||||
Generated
+6
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 2.0 KiB |
@@ -0,0 +1,40 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://cm8gnfvfysyyl"
|
||||
path="res://.godot/imported/stone-Sheet.png-6a8d5c3feec80de1d12c1419c56fc3a4.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://Assets/Sprites/Characters/Enemies/stone-Sheet.png"
|
||||
dest_files=["res://.godot/imported/stone-Sheet.png-6a8d5c3feec80de1d12c1419c56fc3a4.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/uastc_level=0
|
||||
compress/rdo_quality_loss=0.0
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/channel_remap/red=0
|
||||
process/channel_remap/green=1
|
||||
process/channel_remap/blue=2
|
||||
process/channel_remap/alpha=3
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 1.2 KiB |
@@ -0,0 +1,40 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://be7hl01iuo5af"
|
||||
path="res://.godot/imported/kitsune-Sheet.png-2e8e87b85c8cd31c30e570eeeb293f55.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://Assets/Sprites/Characters/Player/kitsune-Sheet.png"
|
||||
dest_files=["res://.godot/imported/kitsune-Sheet.png-2e8e87b85c8cd31c30e570eeeb293f55.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/uastc_level=0
|
||||
compress/rdo_quality_loss=0.0
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/channel_remap/red=0
|
||||
process/channel_remap/green=1
|
||||
process/channel_remap/blue=2
|
||||
process/channel_remap/alpha=3
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 4.6 KiB |
@@ -0,0 +1,40 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://cs7vjtoap8v26"
|
||||
path="res://.godot/imported/environment.png-c68fc1d70faa64deb3834f90b15ce83a.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://Assets/Sprites/Environments/environment.png"
|
||||
dest_files=["res://.godot/imported/environment.png-c68fc1d70faa64deb3834f90b15ce83a.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/uastc_level=0
|
||||
compress/rdo_quality_loss=0.0
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/channel_remap/red=0
|
||||
process/channel_remap/green=1
|
||||
process/channel_remap/blue=2
|
||||
process/channel_remap/alpha=3
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
||||
@@ -0,0 +1,89 @@
|
||||
[gd_scene load_steps=12 format=3 uid="uid://y54cvugsx75b"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://cm8gnfvfysyyl" path="res://Assets/Sprites/Characters/Enemies/stone-Sheet.png" id="1_7puah"]
|
||||
[ext_resource type="Script" uid="uid://cu37tswrk107q" path="res://Scripts/Enemies/EnemyMovement.cs" id="2_wtb2n"]
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_ldgsr"]
|
||||
atlas = ExtResource("1_7puah")
|
||||
region = Rect2(0, 0, 32, 32)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_o5yvi"]
|
||||
atlas = ExtResource("1_7puah")
|
||||
region = Rect2(32, 0, 32, 32)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_rku1e"]
|
||||
atlas = ExtResource("1_7puah")
|
||||
region = Rect2(64, 0, 32, 32)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_rfjv2"]
|
||||
atlas = ExtResource("1_7puah")
|
||||
region = Rect2(96, 0, 32, 32)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_1phco"]
|
||||
atlas = ExtResource("1_7puah")
|
||||
region = Rect2(128, 0, 32, 32)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_nb51f"]
|
||||
atlas = ExtResource("1_7puah")
|
||||
region = Rect2(160, 0, 32, 32)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_nnt18"]
|
||||
atlas = ExtResource("1_7puah")
|
||||
region = Rect2(192, 0, 32, 32)
|
||||
|
||||
[sub_resource type="SpriteFrames" id="SpriteFrames_ewbju"]
|
||||
animations = [{
|
||||
"frames": [{
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_ldgsr")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_o5yvi")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_rku1e")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_rfjv2")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_1phco")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_nb51f")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_nnt18")
|
||||
}],
|
||||
"loop": true,
|
||||
"name": &"default",
|
||||
"speed": 5.0
|
||||
}]
|
||||
|
||||
[sub_resource type="CircleShape2D" id="CircleShape2D_i6g32"]
|
||||
radius = 7.0
|
||||
|
||||
[node name="RockBoi" type="CharacterBody2D"]
|
||||
motion_mode = 1
|
||||
|
||||
[node name="NavigationAgent2D" type="NavigationAgent2D" parent="."]
|
||||
path_desired_distance = 1.0
|
||||
simplify_path = true
|
||||
simplify_epsilon = 0.25
|
||||
|
||||
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."]
|
||||
texture_filter = 1
|
||||
sprite_frames = SubResource("SpriteFrames_ewbju")
|
||||
offset = Vector2(0, -16)
|
||||
|
||||
[node name="Scripts" type="Node" parent="."]
|
||||
|
||||
[node name="Movement" type="Node" parent="Scripts" node_paths=PackedStringArray("_agent2D", "_body2D")]
|
||||
script = ExtResource("2_wtb2n")
|
||||
_agent2D = NodePath("../../NavigationAgent2D")
|
||||
_body2D = NodePath("../..")
|
||||
_speed = 44.59
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||
position = Vector2(0, -7)
|
||||
shape = SubResource("CircleShape2D_i6g32")
|
||||
@@ -0,0 +1,83 @@
|
||||
[gd_scene load_steps=11 format=3 uid="uid://cx7gr555b1gov"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://be7hl01iuo5af" path="res://Assets/Sprites/Characters/Player/kitsune-Sheet.png" id="1_5wxv7"]
|
||||
[ext_resource type="Script" uid="uid://8drbh4rcl410" path="res://Scripts/PlayerMovement.cs" id="2_y5hcb"]
|
||||
|
||||
[sub_resource type="CapsuleShape2D" id="CapsuleShape2D_wrm1d"]
|
||||
radius = 2.0
|
||||
height = 10.0
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_3dryh"]
|
||||
atlas = ExtResource("1_5wxv7")
|
||||
region = Rect2(0, 0, 16, 32)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_wowpa"]
|
||||
atlas = ExtResource("1_5wxv7")
|
||||
region = Rect2(16, 0, 16, 32)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_i6g32"]
|
||||
atlas = ExtResource("1_5wxv7")
|
||||
region = Rect2(32, 0, 16, 32)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_1l0tm"]
|
||||
atlas = ExtResource("1_5wxv7")
|
||||
region = Rect2(48, 0, 16, 32)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_v158k"]
|
||||
atlas = ExtResource("1_5wxv7")
|
||||
region = Rect2(64, 0, 16, 32)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_h4fw4"]
|
||||
atlas = ExtResource("1_5wxv7")
|
||||
region = Rect2(80, 0, 16, 32)
|
||||
|
||||
[sub_resource type="SpriteFrames" id="SpriteFrames_ebmjs"]
|
||||
animations = [{
|
||||
"frames": [{
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_3dryh")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_wowpa")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_i6g32")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_1l0tm")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_v158k")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_h4fw4")
|
||||
}],
|
||||
"loop": true,
|
||||
"name": &"idle",
|
||||
"speed": 8.0
|
||||
}]
|
||||
|
||||
[node name="Player" type="CharacterBody2D"]
|
||||
y_sort_enabled = true
|
||||
texture_filter = 1
|
||||
collision_layer = 2
|
||||
collision_mask = 5
|
||||
motion_mode = 1
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||
position = Vector2(0, -2)
|
||||
rotation = 1.5707964
|
||||
shape = SubResource("CapsuleShape2D_wrm1d")
|
||||
|
||||
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."]
|
||||
sprite_frames = SubResource("SpriteFrames_ebmjs")
|
||||
animation = &"idle"
|
||||
frame_progress = 0.8244228
|
||||
offset = Vector2(0, -16)
|
||||
|
||||
[node name="Scripts" type="Node" parent="."]
|
||||
|
||||
[node name="Movement" type="Node" parent="Scripts" node_paths=PackedStringArray("_body2D")]
|
||||
script = ExtResource("2_y5hcb")
|
||||
_body2D = NodePath("../..")
|
||||
_speed = 4000.0
|
||||
@@ -0,0 +1,86 @@
|
||||
[gd_resource type="TileSet" load_steps=3 format=3 uid="uid://b15j7vhkfu415"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://cs7vjtoap8v26" path="res://Assets/Sprites/Environments/environment.png" id="1_weel8"]
|
||||
|
||||
[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_12wsl"]
|
||||
texture = ExtResource("1_weel8")
|
||||
0:0/0 = 0
|
||||
0:0/0/physics_layer_0/polygon_0/points = PackedVector2Array(0, 8, 0, 0, 8, 0, 8, -8, -8, -8, -8, 8)
|
||||
2:2/0 = 0
|
||||
2:2/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, 0, 0, 0, 0, -8, 8, -8, 8, 8, -8, 8)
|
||||
1:2/0 = 0
|
||||
1:2/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, 0, 8, 0, 8, 8, -8, 8)
|
||||
0:2/0 = 0
|
||||
0:2/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 0, -8, 0, 0, 8, 0, 8, 8, -8, 8)
|
||||
0:1/0 = 0
|
||||
0:1/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 0, -8, 0, 8, -8, 8)
|
||||
1:0/0 = 0
|
||||
1:0/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 0, -8, 0)
|
||||
1:1/0 = 0
|
||||
2:1/0 = 0
|
||||
2:1/0/physics_layer_0/polygon_0/points = PackedVector2Array(0, -8, 0, 8, 8, 8, 8, -8)
|
||||
2:0/0 = 0
|
||||
2:0/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, 0, 0, 0, 0, 8, 8, 8, 8, -8, -8, -8)
|
||||
3:0/0 = 0
|
||||
3:0/0/physics_layer_0/polygon_0/points = PackedVector2Array(0, 8, 0, 0, 8, 0, 8, -8, -8, -8, -8, 8)
|
||||
3:1/0 = 0
|
||||
3:1/0/physics_layer_0/polygon_0/points = PackedVector2Array(0, -8, 0, 8, -8, 8, -8, -8)
|
||||
3:2/0 = 0
|
||||
3:2/0/physics_layer_0/polygon_0/points = PackedVector2Array(0, -8, 0, 0, 8, 0, 8, 8, -8, 8, -8, -8)
|
||||
4:2/0 = 0
|
||||
4:2/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, 0, 8, 0, 8, 8, -8, 8)
|
||||
4:1/0 = 0
|
||||
4:0/0 = 0
|
||||
4:0/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, 0, 8, 0, 8, -8, -8, -8)
|
||||
5:0/0 = 0
|
||||
5:0/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, 0, 0, 0, 0, 8, 8, 8, 8, -8, -8, -8)
|
||||
5:1/0 = 0
|
||||
5:1/0/physics_layer_0/polygon_0/points = PackedVector2Array(0, -8, 0, 8, 8, 8, 8, -8)
|
||||
5:2/0 = 0
|
||||
5:2/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, 0, 0, 0, 0, -8, 8, -8, 8, 8, -8, 8)
|
||||
7:1/0 = 0
|
||||
8:1/0 = 0
|
||||
9:1/0 = 0
|
||||
7:2/0 = 0
|
||||
8:2/0 = 0
|
||||
9:2/0 = 0
|
||||
8:4/size_in_atlas = Vector2i(1, 2)
|
||||
8:4/0 = 0
|
||||
8:4/0/texture_origin = Vector2i(0, 8)
|
||||
8:4/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, 0, 8, 0, 8, 8, -8, 8)
|
||||
9:4/size_in_atlas = Vector2i(1, 2)
|
||||
9:4/0 = 0
|
||||
9:4/0/texture_origin = Vector2i(0, 8)
|
||||
9:4/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, 0, 6, 0, 6, 8, -8, 8)
|
||||
0:4/size_in_atlas = Vector2i(4, 5)
|
||||
0:4/0 = 0
|
||||
0:4/0/texture_origin = Vector2i(0, 32)
|
||||
0:4/0/y_sort_origin = -4
|
||||
0:4/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -4, 8, -4, 12, 4, -12, 4)
|
||||
7:4/size_in_atlas = Vector2i(1, 2)
|
||||
7:4/0 = 0
|
||||
7:4/0/texture_origin = Vector2i(0, 8)
|
||||
7:4/0/physics_layer_0/polygon_0/points = PackedVector2Array(-6, 0, 8, 0, 8, 8, -6, 8)
|
||||
4:7/size_in_atlas = Vector2i(2, 2)
|
||||
4:7/0 = 0
|
||||
4:7/0/texture_origin = Vector2i(0, 8)
|
||||
4:7/0/physics_layer_0/polygon_0/points = PackedVector2Array(-16, 0, 16, 0, 12, 8, -12, 8)
|
||||
5:6/0 = 0
|
||||
5:6/0/y_sort_origin = 4
|
||||
5:6/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, 6, -6, 8, 6, 8, 8, 6, 8, 4, -8, 4)
|
||||
7:7/size_in_atlas = Vector2i(1, 2)
|
||||
7:7/0 = 0
|
||||
7:7/0/texture_origin = Vector2i(0, 8)
|
||||
7:7/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, 0, 0.9892235, 0, 8, 0, 8, 8, -8, 8)
|
||||
8:7/size_in_atlas = Vector2i(1, 2)
|
||||
8:7/0 = 0
|
||||
8:7/0/texture_origin = Vector2i(0, 8)
|
||||
8:7/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, 0, 8, 0, 8, 8, -8, 8)
|
||||
9:7/size_in_atlas = Vector2i(1, 2)
|
||||
9:7/0 = 0
|
||||
9:7/0/texture_origin = Vector2i(0, 8)
|
||||
9:7/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, 0, 8, 0, 8, 8, -8, 8)
|
||||
|
||||
[resource]
|
||||
physics_layer_0/collision_layer = 1
|
||||
sources/0 = SubResource("TileSetAtlasSource_12wsl")
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,14 @@
|
||||
using Godot;
|
||||
using System;
|
||||
|
||||
public partial class GameController : Node
|
||||
{
|
||||
public static GameController Instance;
|
||||
|
||||
[Export] public Node2D Player;
|
||||
|
||||
public override void _Ready()
|
||||
{
|
||||
GameController.Instance = this;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
uid://djp8dmixf6sq2
|
||||
@@ -0,0 +1,26 @@
|
||||
using Godot;
|
||||
using System;
|
||||
|
||||
public partial class EnemyMovement : Node
|
||||
{
|
||||
[Export] private NavigationAgent2D _agent2D;
|
||||
[Export] private CharacterBody2D _body2D;
|
||||
[Export] private float _speed;
|
||||
|
||||
private double _time = 0;
|
||||
|
||||
public override void _PhysicsProcess(double delta)
|
||||
{
|
||||
_time += delta;
|
||||
if (_time > 0.2)
|
||||
{
|
||||
_time = 0;
|
||||
_agent2D.SetTargetPosition(GameController.Instance.Player.GlobalPosition);
|
||||
}
|
||||
// _parent.Position = _agent2D.GetNextPathPosition();
|
||||
var gpos = _agent2D.GetNextPathPosition();
|
||||
var dir = (gpos - _body2D.GlobalPosition).Normalized();
|
||||
// _body2D.SetVelocity(dir * _speed * (float)delta);
|
||||
_body2D.GlobalPosition += dir * _speed * (float)delta;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
uid://cu37tswrk107q
|
||||
@@ -0,0 +1,31 @@
|
||||
using Godot;
|
||||
using System;
|
||||
|
||||
public partial class PlayerMovement : Node
|
||||
{
|
||||
[Export] private CharacterBody2D _body2D;
|
||||
|
||||
[Export] private float _speed;
|
||||
|
||||
private Vector2 _direction = new ();
|
||||
|
||||
public override void _Process(double delta)
|
||||
{
|
||||
ReadInput();
|
||||
}
|
||||
|
||||
public override void _PhysicsProcess(double delta)
|
||||
{
|
||||
float dt = (float)delta;
|
||||
|
||||
_body2D.SetVelocity(_direction * _speed * dt);
|
||||
_body2D.MoveAndSlide();
|
||||
}
|
||||
|
||||
private void ReadInput()
|
||||
{
|
||||
_direction.X = Input.GetAxis("move_left", "move_right");
|
||||
_direction.Y = Input.GetAxis("move_up", "move_down");
|
||||
_direction = _direction.Normalized();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
uid://8drbh4rcl410
|
||||
@@ -0,0 +1,7 @@
|
||||
<Project Sdk="Godot.NET.Sdk/4.5.0">
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<TargetFramework Condition=" '$(GodotTargetPlatform)' == 'android' ">net9.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}") = "fgj26", "fgj26.csproj", "{ECD24DA8-80B8-437C-9DB1-839996C9A21B}"
|
||||
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
|
||||
{ECD24DA8-80B8-437C-9DB1-839996C9A21B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{ECD24DA8-80B8-437C-9DB1-839996C9A21B}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{ECD24DA8-80B8-437C-9DB1-839996C9A21B}.ExportDebug|Any CPU.ActiveCfg = ExportDebug|Any CPU
|
||||
{ECD24DA8-80B8-437C-9DB1-839996C9A21B}.ExportDebug|Any CPU.Build.0 = ExportDebug|Any CPU
|
||||
{ECD24DA8-80B8-437C-9DB1-839996C9A21B}.ExportRelease|Any CPU.ActiveCfg = ExportRelease|Any CPU
|
||||
{ECD24DA8-80B8-437C-9DB1-839996C9A21B}.ExportRelease|Any CPU.Build.0 = ExportRelease|Any CPU
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
+45
-1
@@ -11,9 +11,53 @@ config_version=5
|
||||
[application]
|
||||
|
||||
config/name="fgj26"
|
||||
config/features=PackedStringArray("4.5", "Forward Plus")
|
||||
run/main_scene="uid://csyk43kt3xbyx"
|
||||
config/features=PackedStringArray("4.5", "C#", "Forward Plus")
|
||||
config/icon="res://icon.svg"
|
||||
|
||||
[dotnet]
|
||||
|
||||
project/assembly_name="fgj26"
|
||||
|
||||
[input]
|
||||
|
||||
move_up={
|
||||
"deadzone": 0.1,
|
||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":87,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
|
||||
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":0,"axis":1,"axis_value":-1.0,"script":null)
|
||||
]
|
||||
}
|
||||
move_right={
|
||||
"deadzone": 0.1,
|
||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":68,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
|
||||
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":0,"axis":0,"axis_value":1.0,"script":null)
|
||||
]
|
||||
}
|
||||
move_down={
|
||||
"deadzone": 0.1,
|
||||
"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":83,"key_label":0,"unicode":115,"location":0,"echo":false,"script":null)
|
||||
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":0,"axis":1,"axis_value":1.0,"script":null)
|
||||
]
|
||||
}
|
||||
move_left={
|
||||
"deadzone": 0.1,
|
||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":65,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
|
||||
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":0,"axis":0,"axis_value":-1.0,"script":null)
|
||||
]
|
||||
}
|
||||
dash={
|
||||
"deadzone": 0.1,
|
||||
"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":4194325,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
|
||||
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":0,"pressure":0.0,"pressed":false,"script":null)
|
||||
]
|
||||
}
|
||||
attack={
|
||||
"deadzone": 0.1,
|
||||
"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":32,"key_label":0,"unicode":32,"location":0,"echo":false,"script":null)
|
||||
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":2,"pressure":0.0,"pressed":false,"script":null)
|
||||
]
|
||||
}
|
||||
|
||||
[physics]
|
||||
|
||||
2d/default_gravity_vector=Vector2(0, 0)
|
||||
|
||||
Reference in New Issue
Block a user