mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-01 11:05:34 +00:00
Basic Movement fixes
This commit is contained in:
parent
3e2b6c2c9c
commit
c9b3164362
5 changed files with 66 additions and 11 deletions
23
.vscode/launch.json
vendored
Normal file
23
.vscode/launch.json
vendored
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
{
|
||||
// Use IntelliSense to learn about possible attributes.
|
||||
// Hover to view descriptions of existing attributes.
|
||||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"name": "Launch Project",
|
||||
"type": "cppvsdbg",
|
||||
"request": "launch",
|
||||
"program": "${workspaceFolder}/bin/godot.windows.editor.dev.x86_64.exe",
|
||||
// Change the arguments below for the project you want to test with.
|
||||
// To run the project instead of editing it, remove the "--editor" argument.
|
||||
"args": [ "--editor", "--path", "path-to-your-godot-project-folder" ],
|
||||
"stopAtEntry": false,
|
||||
"cwd": "${workspaceFolder}",
|
||||
"environment": [],
|
||||
"console": "internalConsole",
|
||||
"visualizerFile": "${workspaceFolder}/platform/windows/godot.natvis",
|
||||
"preLaunchTask": "build"
|
||||
}
|
||||
]
|
||||
}
|
||||
18
.vscode/tasks.json
vendored
Normal file
18
.vscode/tasks.json
vendored
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
{
|
||||
// See https://go.microsoft.com/fwlink/?LinkId=733558
|
||||
// for the documentation about the tasks.json format
|
||||
"version": "2.0.0",
|
||||
"tasks": [
|
||||
{
|
||||
"label": "build",
|
||||
"group": "build",
|
||||
"type": "shell",
|
||||
"command": "scons",
|
||||
"args": [
|
||||
// enable for debugging with breakpoints
|
||||
"dev_build=yes",
|
||||
],
|
||||
"problemMatcher": "$msCompile"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
[gd_scene load_steps=20 format=3 uid="uid://bv451a8wgty4u"]
|
||||
[gd_scene load_steps=21 format=3 uid="uid://bv451a8wgty4u"]
|
||||
|
||||
[ext_resource type="Script" path="res://Scripts/PlayerMovement.cs" id="1_fwei5"]
|
||||
[ext_resource type="Texture2D" uid="uid://dowueaq2rixdk" path="res://Sprites/Cirno2.0.png" id="2_uhufh"]
|
||||
|
|
@ -19,7 +19,7 @@
|
|||
[ext_resource type="Texture2D" uid="uid://dgnbwg4my1jfe" path="res://Sprites/Cirno2.15.png" id="17_et2yp"]
|
||||
|
||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_2gpmr"]
|
||||
size = Vector2(126, 127)
|
||||
size = Vector2(6, 8)
|
||||
|
||||
[sub_resource type="SpriteFrames" id="SpriteFrames_ur7bf"]
|
||||
animations = [{
|
||||
|
|
@ -100,22 +100,34 @@ animations = [{
|
|||
"speed": 5.0
|
||||
}]
|
||||
|
||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_qui05"]
|
||||
size = Vector2(20, 153)
|
||||
|
||||
[node name="Node2D" type="Node2D"]
|
||||
position = Vector2(38, 39)
|
||||
|
||||
[node name="CharacterBody2D" type="CharacterBody2D" parent="."]
|
||||
script = ExtResource("1_fwei5")
|
||||
Speed = 1600
|
||||
|
||||
[node name="Sprite2D" type="Sprite2D" parent="CharacterBody2D"]
|
||||
visible = false
|
||||
texture = ExtResource("2_uhufh")
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="CharacterBody2D"]
|
||||
position = Vector2(0, -0.5)
|
||||
shape = SubResource("RectangleShape2D_2gpmr")
|
||||
|
||||
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="CharacterBody2D"]
|
||||
scale = Vector2(15.75, 15.75)
|
||||
sprite_frames = SubResource("SpriteFrames_ur7bf")
|
||||
animation = &"walk_down"
|
||||
frame = 1
|
||||
frame_progress = 0.964336
|
||||
|
||||
[node name="StaticBody2D" type="StaticBody2D" parent="."]
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="StaticBody2D"]
|
||||
position = Vector2(113, 54.5)
|
||||
shape = SubResource("RectangleShape2D_qui05")
|
||||
|
||||
[node name="Polygon2D" type="Polygon2D" parent="StaticBody2D"]
|
||||
polygon = PackedVector2Array(103, -21, 123, -22, 122, 131, 105, 131)
|
||||
|
|
|
|||
|
|
@ -25,16 +25,16 @@ public partial class PlayerMovement : CharacterBody2D
|
|||
}
|
||||
}*/
|
||||
|
||||
public void GetInput()
|
||||
public Vector2 GetInput()
|
||||
{
|
||||
|
||||
Vector2 inputDirection = Input.GetVector("left", "right", "up", "down");
|
||||
Velocity = inputDirection * Speed;
|
||||
return Input.GetVector("left", "right", "up", "down");
|
||||
}
|
||||
|
||||
public override void _PhysicsProcess(double delta)
|
||||
{
|
||||
GetInput();
|
||||
var inputDirection = GetInput();
|
||||
Velocity = inputDirection * (float)(Speed * delta);
|
||||
|
||||
MoveAndSlide();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,9 +17,11 @@ config/icon="res://icon.svg"
|
|||
|
||||
[display]
|
||||
|
||||
window/size/viewport_width=384
|
||||
window/size/viewport_height=216
|
||||
window/size/viewport_width=640
|
||||
window/size/viewport_height=480
|
||||
window/stretch/mode="viewport"
|
||||
window/stretch/scale=4.0
|
||||
window/stretch/scale_mode="integer"
|
||||
|
||||
[dotnet]
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue