trying to get essentials working
This commit is contained in:
parent
c30449c479
commit
34ba37312a
9 changed files with 80 additions and 16 deletions
18
scripts/Player.cs
Normal file
18
scripts/Player.cs
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
/// <summary>
|
||||
/// Moves the player using top-down controls.
|
||||
/// </summary>
|
||||
|
||||
using Godot;
|
||||
//using System;
|
||||
|
||||
public partial class Player : CharacterBody2D
|
||||
{
|
||||
[Export] public float Speed = 220f;
|
||||
|
||||
public override void _PhysicsProcess(double delta)
|
||||
{
|
||||
Vector2 input = Input.GetVector("ui_left", "ui_right", "ui_up", "ui_down");
|
||||
Velocity = input * Speed;
|
||||
MoveAndSlide();
|
||||
}
|
||||
}
|
||||
1
scripts/Player.cs.uid
Normal file
1
scripts/Player.cs.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://duf0vlr2yin8l
|
||||
16
scripts/Visual.cs
Normal file
16
scripts/Visual.cs
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
using Godot;
|
||||
|
||||
public partial class PlayerVisual : Node2D
|
||||
{
|
||||
[Export] public float Radius = 8f;
|
||||
|
||||
public override void _Draw()
|
||||
{
|
||||
DrawCircle(Vector2.Zero, Radius, new Color(0.2f, 0.8f, 1.0f));
|
||||
}
|
||||
|
||||
public override void _Ready()
|
||||
{
|
||||
QueueRedraw();
|
||||
}
|
||||
}
|
||||
1
scripts/Visual.cs.uid
Normal file
1
scripts/Visual.cs.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://b25o2r2lf6nst
|
||||
Loading…
Add table
Add a link
Reference in a new issue