Initial Checkin of Code

This commit is contained in:
Mario Steele 2025-04-11 13:35:55 -05:00
parent 19b557ee9b
commit 0bee2ee47b
44 changed files with 7965 additions and 0 deletions

13
.idea/.idea.PokemonLike/.idea/.gitignore generated vendored Normal file
View file

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

View file

@ -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>

View file

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

4
.idea/.idea.PokemonLike/.idea/vcs.xml generated Normal file
View file

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings" defaultProject="true" />
</project>

Binary file not shown.

After

Width:  |  Height:  |  Size: 99 KiB

View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://bci0ojcx84f7w"
path="res://.godot/imported/player.png-84c5bc0071fb078bb82f3c313d328d34.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://Assets/characters/player.png"
dest_files=["res://.godot/imported/player.png-84c5bc0071fb078bb82f3c313d328d34.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
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/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

BIN
Assets/levels/buildings.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 142 KiB

View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://bbuvhal85ki8q"
path="res://.godot/imported/buildings.png-25307f1c791c2eb192be0c4a9e9108e9.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://Assets/levels/buildings.png"
dest_files=["res://.godot/imported/buildings.png-25307f1c791c2eb192be0c4a9e9108e9.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
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/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: 247 KiB

View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://co3x7b7818edl"
path="res://.godot/imported/environment.png-ae57071bc5669062869ec4f3e83d8a33.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://Assets/levels/environment.png"
dest_files=["res://.godot/imported/environment.png-ae57071bc5669062869ec4f3e83d8a33.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
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/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

View file

@ -0,0 +1,69 @@
using Godot;
using PokemonLike.Library.Support;
namespace PokemonLike.Library.Characters;
[GlobalClass]
public partial class CharacterAnimation : AnimatedSprite2D
{
[ExportCategory("Nodes")]
[Export] public CharacterInput CharacterInput;
[Export] public CharacterMovement CharacterMovement;
[ExportCategory("Animation Vars")]
[Export] public ECharacterAnimation ECharacterAnimation = ECharacterAnimation.IdleDown;
public override void _Ready()
{
CharacterMovement.Animation += PlayAnimation;
Logger.Info("Loading player animation component ...");
}
public void PlayAnimation(string animationType)
{
ECharacterAnimation previousAnimation = ECharacterAnimation;
if (CharacterMovement.IsMoving()) return;
switch (animationType)
{
case "walk":
if (CharacterInput.Direction == Vector2.Up)
ECharacterAnimation = ECharacterAnimation.WalkUp;
else if (CharacterInput.Direction == Vector2.Left)
ECharacterAnimation = ECharacterAnimation.WalkLeft;
else if (CharacterInput.Direction == Vector2.Right)
ECharacterAnimation = ECharacterAnimation.WalkRight;
else if (CharacterInput.Direction == Vector2.Down)
ECharacterAnimation = ECharacterAnimation.WalkDown;
break;
case "turn":
if (CharacterInput.Direction == Vector2.Up)
ECharacterAnimation = ECharacterAnimation.TurnUp;
else if (CharacterInput.Direction == Vector2.Left)
ECharacterAnimation = ECharacterAnimation.TurnLeft;
else if (CharacterInput.Direction == Vector2.Right)
ECharacterAnimation = ECharacterAnimation.TurnRight;
else if (CharacterInput.Direction == Vector2.Down)
ECharacterAnimation = ECharacterAnimation.TurnDown;
break;
case "idle":
if (CharacterInput.Direction == Vector2.Up)
ECharacterAnimation = ECharacterAnimation.IdleUp;
else if (CharacterInput.Direction == Vector2.Left)
ECharacterAnimation = ECharacterAnimation.IdleLeft;
else if (CharacterInput.Direction == Vector2.Right)
ECharacterAnimation = ECharacterAnimation.IdleRight;
else if (CharacterInput.Direction == Vector2.Down)
ECharacterAnimation = ECharacterAnimation.IdleDown;
break;
}
if (previousAnimation != ECharacterAnimation)
{
Logger.Debug($"Playing animation {ECharacterAnimation}");
Play(ECharacterAnimation.ToString().ToSnakeCase());
}
}
}

View file

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

View file

@ -0,0 +1,18 @@
using Godot;
using PokemonLike.Library.Support;
namespace PokemonLike.Library.Characters;
[GlobalClass]
public abstract partial class CharacterInput : Node
{
[Signal]
public delegate void WalkEventHandler();
[Signal]
public delegate void TurnEventHandler();
[ExportCategory("Common Input")]
[Export] public Vector2 Direction = Vector2.Zero;
[Export] public Vector2 TargetPosition = Vector2.Zero;
}

View file

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

View file

@ -0,0 +1,83 @@
using Godot;
using System;
using PokemonLike.Library.Support;
namespace PokemonLike.Library.Characters;
[GlobalClass]
public partial class CharacterMovement : Node
{
[Signal]
public delegate void AnimationEventHandler(string animationType);
[ExportCategory("Nodes")]
[Export] public CharacterBody2D Character;
[Export] public CharacterInput CharacterInput;
[ExportCategory("Movement")]
[Export] public Vector2 TargetPosition = Vector2.Zero;
[Export] public bool IsWalking = false;
public override void _Ready()
{
CharacterInput.Walk += StartWalking;
CharacterInput.Turn += Turn;
Logger.Info("Loading player movement component ...");
}
public override void _Process(double delta)
{
Walk(delta);
}
public bool IsMoving() => IsWalking;
public void StartWalking()
{
if (!IsMoving())
{
EmitSignal(SignalName.Animation, "walk");
TargetPosition = Character.Position + CharacterInput.Direction * Globals.Instance.GRID_SIZE;
Logger.Debug($"Moving from {Character.Position} to {TargetPosition}");
IsWalking = true;
}
}
public void Walk(double delta)
{
if (IsWalking)
{
Character.Position =
Character.Position.MoveToward(TargetPosition, (float)delta * Globals.Instance.GRID_SIZE * 4);
if (Character.Position.DistanceTo(TargetPosition) < 1f)
{
StopWalking();
}
}
else
{
EmitSignal(SignalName.Animation, "idle");
}
}
public void StopWalking()
{
IsWalking = false;
SnapPositionToGrid();
}
public void Turn()
{
EmitSignal(SignalName.Animation, "turn");
}
public void SnapPositionToGrid()
{
Character.Position = new Vector2(
Mathf.Round(Character.Position.X / Globals.Instance.GRID_SIZE) * Globals.Instance.GRID_SIZE,
Mathf.Round(Character.Position.Y / Globals.Instance.GRID_SIZE) * Globals.Instance.GRID_SIZE
);
}
}

View file

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

View file

@ -0,0 +1,15 @@
using Godot;
using PokemonLike.Library.Utilities;
namespace PokemonLike.Library.Characters;
[GlobalClass]
public partial class Player : CharacterBody2D
{
[Export] public StateMachine StateMachine;
public override void _Ready()
{
StateMachine.ChangeState(StateMachine.GetNode<State>("Roam"));
}
}

View file

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

View file

@ -0,0 +1,17 @@
using Godot;
using PokemonLike.Library.Support;
namespace PokemonLike.Library.Characters;
[GlobalClass]
public partial class PlayerInput : CharacterInput
{
[ExportCategory("Player Input")]
[Export] public double HoldThreshold = 0.1f;
[Export] public double HoldTime = 0.0f;
public override void _Ready()
{
Logger.Info("Loading player input component ...");
}
}

View file

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

View file

@ -0,0 +1,63 @@
using Godot;
using PokemonLike.Library.Support;
using PokemonLike.Library.Utilities;
namespace PokemonLike.Library.Characters.States;
[GlobalClass]
public partial class PlayerRoamState : State
{
[ExportCategory("State Vars")]
[Export] public PlayerInput PlayerInput;
public override void _Process(double delta)
{
GetInputDirection();
GetInput(delta);
}
public void GetInputDirection()
{
if (Input.IsActionJustPressed("move_up"))
{
PlayerInput.Direction = Vector2.Up;
PlayerInput.TargetPosition = new Vector2(0, -Globals.Instance.GRID_SIZE);
}
else if (Input.IsActionJustPressed("move_down"))
{
PlayerInput.Direction = Vector2.Down;
PlayerInput.TargetPosition = new Vector2(0, Globals.Instance.GRID_SIZE);
}
else if (Input.IsActionJustPressed("move_left"))
{
PlayerInput.Direction = Vector2.Left;
PlayerInput.TargetPosition = new Vector2(-Globals.Instance.GRID_SIZE, 0);
}
else if (Input.IsActionJustPressed("move_right"))
{
PlayerInput.Direction = Vector2.Right;
PlayerInput.TargetPosition = new Vector2(Globals.Instance.GRID_SIZE, 0);
}
}
public void GetInput(double delta)
{
if (Modules.IsActionJustReleased())
{
if (PlayerInput.HoldTime > PlayerInput.HoldThreshold)
PlayerInput.EmitSignal(CharacterInput.SignalName.Walk);
else
PlayerInput.EmitSignal(CharacterInput.SignalName.Turn);
PlayerInput.HoldThreshold = 0.0f;
}
if (Modules.IsActionPressed())
{
PlayerInput.HoldTime += delta;
if (PlayerInput.HoldTime > PlayerInput.HoldThreshold)
PlayerInput.EmitSignal(CharacterInput.SignalName.Walk);
}
}
}

View file

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

26
Library/Support/Enums.cs Normal file
View file

@ -0,0 +1,26 @@
namespace PokemonLike.Library.Support;
public enum LogLevel
{
None,
Error,
Info,
Warn,
Debug,
}
public enum ECharacterAnimation
{
IdleDown,
IdleUp,
IdleLeft,
IdleRight,
TurnDown,
TurnUp,
TurnLeft,
TurnRight,
WalkDown,
WalkUp,
WalkLeft,
WalkRight,
}

View file

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

View file

@ -0,0 +1,18 @@
using Godot;
namespace PokemonLike.Library.Support;
public partial class Globals : Node
{
public static Globals Instance { get; private set; }
[ExportCategory("Gameplay")]
[Export] public int GRID_SIZE = 16;
public override void _Ready()
{
Instance = this;
Logger.Info("Loading Globals ... ");
}
}

View file

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

35
Library/Support/Logger.cs Normal file
View file

@ -0,0 +1,35 @@
using System;
using System.Diagnostics;
namespace PokemonLike.Library.Support;
public static class Logger
{
public static string ColorTable(LogLevel level) => level switch
{
LogLevel.None => "white",
LogLevel.Error => "firebrick",
LogLevel.Info => "white",
LogLevel.Warn => "gold",
LogLevel.Debug => "green",
};
public static LogLevel LogLevel { get; set; } = LogLevel.Debug;
public static void Log(LogLevel level, params object[] message)
{
if (level > LogLevel) return;
var timeStamp = $"[lb]{DateTime.Now:yyyy-MM-dd HH:mm:ss}[rb]";
var callingMethod = new StackTrace().GetFrame(2)?.GetMethod();
var lvl = $"{level}".ToUpper();
var clsName = callingMethod?.DeclaringType?.Name == null ? "UnknownClass" : callingMethod!.DeclaringType!.Name;
var mthdName = callingMethod?.Name == null ? "UnknownMethod" : callingMethod!.Name;
var msg = $"{timeStamp} [lb][color={ColorTable(level)}]{lvl}[/color][rb] [color=cyan][lb]{clsName}->{mthdName}[rb][/color] ";
Godot.GD.PrintRich([msg, ..message]);
}
public static void Info(params object[] message) => Log(LogLevel.Info, message);
public static void Warn(params object[] message) => Log(LogLevel.Warn, message);
public static void Debug(params object[] message) => Log(LogLevel.Debug, message);
public static void Error(params object[] message) => Log(LogLevel.Error, message);
}

View file

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

View file

@ -0,0 +1,28 @@
using Godot;
namespace PokemonLike.Library.Support;
public static class Modules
{
public static bool IsActionJustPressed() => (
Input.IsActionJustPressed("move_up") ||
Input.IsActionJustPressed("move_down") ||
Input.IsActionJustPressed("move_left") ||
Input.IsActionJustPressed("move_right")
);
public static bool IsActionPressed() => (
Input.IsActionPressed("move_up") ||
Input.IsActionPressed("move_down") ||
Input.IsActionPressed("move_left") ||
Input.IsActionPressed("move_right")
);
public static bool IsActionJustReleased() => (
Input.IsActionJustReleased("move_up") ||
Input.IsActionJustReleased("move_down") ||
Input.IsActionJustReleased("move_left") ||
Input.IsActionJustReleased("move_right")
);
}

View file

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

View file

@ -0,0 +1,20 @@
using Godot;
using PokemonLike.Library.Support;
namespace PokemonLike.Library.Utilities;
[GlobalClass]
public abstract partial class State : Node
{
[Export] public Node StateOwner;
public virtual void EnterState()
{
Logger.Info($"Entering {GetType().Name} state ...");
}
public virtual void ExitState()
{
Logger.Info($"Exiting {GetType().Name} state ...");
}
}

View file

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

View file

@ -0,0 +1,37 @@
using Godot;
using PokemonLike.Library.Support;
namespace PokemonLike.Library.Utilities;
[GlobalClass]
public partial class StateMachine : Node
{
[ExportCategory("State Machine Vars")]
[Export] public Node Customer;
[Export] public State CurrentState;
public override void _Ready()
{
Logger.Info("Loading state machine...");
foreach (Node child in GetChildren())
{
if (child is State state)
{
state.StateOwner = Customer;
state.SetProcess(false);
}
}
}
public string GetCurrentState() => CurrentState.Name.ToString();
public void ChangeState(State newState)
{
CurrentState?.ExitState();
CurrentState = newState;
CurrentState?.EnterState();
foreach (Node child in GetChildren())
if (child is State state)
state.SetProcess(state == CurrentState);
}
}

View file

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

6
PokemonLike.csproj Normal file
View file

@ -0,0 +1,6 @@
<Project Sdk="Godot.NET.Sdk/4.4.1">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<EnableDynamicLoading>true</EnableDynamicLoading>
</PropertyGroup>
</Project>

19
PokemonLike.sln Normal file
View file

@ -0,0 +1,19 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2012
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PokemonLike", "PokemonLike.csproj", "{BA8D37E2-532D-49A9-BC0F-54746015184B}"
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
{BA8D37E2-532D-49A9-BC0F-54746015184B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{BA8D37E2-532D-49A9-BC0F-54746015184B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{BA8D37E2-532D-49A9-BC0F-54746015184B}.ExportDebug|Any CPU.ActiveCfg = ExportDebug|Any CPU
{BA8D37E2-532D-49A9-BC0F-54746015184B}.ExportDebug|Any CPU.Build.0 = ExportDebug|Any CPU
{BA8D37E2-532D-49A9-BC0F-54746015184B}.ExportRelease|Any CPU.ActiveCfg = ExportRelease|Any CPU
{BA8D37E2-532D-49A9-BC0F-54746015184B}.ExportRelease|Any CPU.Build.0 = ExportRelease|Any CPU
EndGlobalSection
EndGlobal

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,314 @@
[gd_scene load_steps=38 format=3 uid="uid://b6p8tudwratl1"]
[ext_resource type="Script" uid="uid://b70ubhqc16nw4" path="res://Library/Characters/PlayerInput.cs" id="1_40svl"]
[ext_resource type="Script" uid="uid://b4thjem54fyfl" path="res://Library/Characters/Player.cs" id="1_utp2y"]
[ext_resource type="Texture2D" uid="uid://bci0ojcx84f7w" path="res://Assets/characters/player.png" id="1_v0iea"]
[ext_resource type="Script" uid="uid://bytos0ecojls1" path="res://Library/Characters/CharacterMovement.cs" id="2_al8ar"]
[ext_resource type="Script" uid="uid://bfijr6flufatm" path="res://Library/Characters/CharacterAnimation.cs" id="4_gy20a"]
[ext_resource type="Script" uid="uid://dxo0eunwolubm" path="res://Library/Utilities/StateMachine.cs" id="5_cqrjx"]
[ext_resource type="Script" uid="uid://c5nu12q4or8pw" path="res://Library/Characters/States/PlayerRoamState.cs" id="6_khnq4"]
[sub_resource type="RectangleShape2D" id="RectangleShape2D_cvnsp"]
size = Vector2(16, 16)
[sub_resource type="AtlasTexture" id="AtlasTexture_6t5aa"]
atlas = ExtResource("1_v0iea")
region = Rect2(0, 0, 32, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_vgqql"]
atlas = ExtResource("1_v0iea")
region = Rect2(0, 48, 32, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_fkybt"]
atlas = ExtResource("1_v0iea")
region = Rect2(0, 96, 32, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_x3wgy"]
atlas = ExtResource("1_v0iea")
region = Rect2(0, 144, 32, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_3smsa"]
atlas = ExtResource("1_v0iea")
region = Rect2(32, 0, 32, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_8erm5"]
atlas = ExtResource("1_v0iea")
region = Rect2(0, 0, 32, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_f1ek2"]
atlas = ExtResource("1_v0iea")
region = Rect2(32, 48, 32, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_tx1dd"]
atlas = ExtResource("1_v0iea")
region = Rect2(0, 48, 32, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_gymyn"]
atlas = ExtResource("1_v0iea")
region = Rect2(32, 96, 32, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_pu2lt"]
atlas = ExtResource("1_v0iea")
region = Rect2(0, 96, 32, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_ukyrk"]
atlas = ExtResource("1_v0iea")
region = Rect2(32, 144, 32, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_7dp3o"]
atlas = ExtResource("1_v0iea")
region = Rect2(0, 144, 32, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_h4iuc"]
atlas = ExtResource("1_v0iea")
region = Rect2(32, 0, 32, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_fd4e3"]
atlas = ExtResource("1_v0iea")
region = Rect2(64, 0, 32, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_qqcod"]
atlas = ExtResource("1_v0iea")
region = Rect2(96, 0, 32, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_igrcy"]
atlas = ExtResource("1_v0iea")
region = Rect2(0, 0, 32, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_fs7ks"]
atlas = ExtResource("1_v0iea")
region = Rect2(32, 48, 32, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_l6n3p"]
atlas = ExtResource("1_v0iea")
region = Rect2(64, 48, 32, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_olqyp"]
atlas = ExtResource("1_v0iea")
region = Rect2(96, 48, 32, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_wpjfl"]
atlas = ExtResource("1_v0iea")
region = Rect2(0, 48, 32, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_bi64h"]
atlas = ExtResource("1_v0iea")
region = Rect2(32, 96, 32, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_2ijsl"]
atlas = ExtResource("1_v0iea")
region = Rect2(64, 96, 32, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_p1odr"]
atlas = ExtResource("1_v0iea")
region = Rect2(96, 96, 32, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_0gysh"]
atlas = ExtResource("1_v0iea")
region = Rect2(0, 96, 32, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_vfarp"]
atlas = ExtResource("1_v0iea")
region = Rect2(32, 144, 32, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_y6uwr"]
atlas = ExtResource("1_v0iea")
region = Rect2(64, 144, 32, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_83xs0"]
atlas = ExtResource("1_v0iea")
region = Rect2(96, 144, 32, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_ypfnu"]
atlas = ExtResource("1_v0iea")
region = Rect2(0, 144, 32, 48)
[sub_resource type="SpriteFrames" id="SpriteFrames_xuaoq"]
animations = [{
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_6t5aa")
}],
"loop": true,
"name": &"idle_down",
"speed": 5.0
}, {
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_vgqql")
}],
"loop": true,
"name": &"idle_left",
"speed": 5.0
}, {
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_fkybt")
}],
"loop": true,
"name": &"idle_right",
"speed": 5.0
}, {
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_x3wgy")
}],
"loop": true,
"name": &"idle_up",
"speed": 5.0
}, {
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_3smsa")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_8erm5")
}],
"loop": false,
"name": &"turn_down",
"speed": 5.0
}, {
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_f1ek2")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_tx1dd")
}],
"loop": false,
"name": &"turn_left",
"speed": 5.0
}, {
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_gymyn")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_pu2lt")
}],
"loop": false,
"name": &"turn_right",
"speed": 5.0
}, {
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_ukyrk")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_7dp3o")
}],
"loop": false,
"name": &"turn_up",
"speed": 5.0
}, {
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_h4iuc")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_fd4e3")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_qqcod")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_igrcy")
}],
"loop": true,
"name": &"walk_down",
"speed": 5.0
}, {
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_fs7ks")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_l6n3p")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_olqyp")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_wpjfl")
}],
"loop": true,
"name": &"walk_left",
"speed": 5.0
}, {
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_bi64h")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_2ijsl")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_p1odr")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_0gysh")
}],
"loop": true,
"name": &"walk_right",
"speed": 5.0
}, {
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_vfarp")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_y6uwr")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_83xs0")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_ypfnu")
}],
"loop": true,
"name": &"walk_up",
"speed": 5.0
}]
[node name="Player" type="CharacterBody2D" node_paths=PackedStringArray("StateMachine")]
script = ExtResource("1_utp2y")
StateMachine = NodePath("StateMachine")
[node name="Collider" type="CollisionShape2D" parent="."]
position = Vector2(8, 8)
shape = SubResource("RectangleShape2D_cvnsp")
[node name="Input" type="Node" parent="."]
script = ExtResource("1_40svl")
[node name="Movement" type="Node" parent="." node_paths=PackedStringArray("Character", "CharacterInput")]
script = ExtResource("2_al8ar")
Character = NodePath("..")
CharacterInput = NodePath("../Input")
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="." node_paths=PackedStringArray("CharacterInput", "CharacterMovement")]
position = Vector2(8, 4)
scale = Vector2(0.5, 0.5)
sprite_frames = SubResource("SpriteFrames_xuaoq")
animation = &"idle_down"
script = ExtResource("4_gy20a")
CharacterInput = NodePath("../Input")
CharacterMovement = NodePath("../Movement")
[node name="Camera2D" type="Camera2D" parent="."]
position = Vector2(8, 8)
zoom = Vector2(3, 3)
position_smoothing_enabled = true
[node name="CollisionRayCast" type="RayCast2D" parent="."]
position = Vector2(8, 8)
target_position = Vector2(0, 16)
collide_with_areas = true
[node name="StateMachine" type="Node" parent="." node_paths=PackedStringArray("Customer")]
script = ExtResource("5_cqrjx")
Customer = NodePath("..")
[node name="Roam" type="Node" parent="StateMachine" node_paths=PackedStringArray("PlayerInput")]
script = ExtResource("6_khnq4")
PlayerInput = NodePath("../../Input")

File diff suppressed because one or more lines are too long

35
Scenes/game_manager.tscn Normal file
View file

@ -0,0 +1,35 @@
[gd_scene load_steps=3 format=3 uid="uid://bitxjixlf2fcv"]
[ext_resource type="PackedScene" uid="uid://bcskdyiep4mxx" path="res://Scenes/Levels/small_town.tscn" id="1_e5fcp"]
[ext_resource type="PackedScene" uid="uid://b6p8tudwratl1" path="res://Scenes/Characters/player.tscn" id="2_sq00h"]
[node name="GameManager" type="Node"]
[node name="Control" type="Control" parent="."]
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
[node name="SubViewportContainer" type="SubViewportContainer" parent="Control"]
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
stretch = true
[node name="SubViewport" type="SubViewport" parent="Control/SubViewportContainer"]
handle_input_locally = false
size = Vector2i(1152, 648)
size_2d_override = Vector2i(1152, 648)
size_2d_override_stretch = true
render_target_update_mode = 4
[node name="Level" parent="Control/SubViewportContainer/SubViewport" instance=ExtResource("1_e5fcp")]
[node name="Player" parent="Control/SubViewportContainer/SubViewport" instance=ExtResource("2_sq00h")]
position = Vector2(94, 143)

7
default_env.tres Normal file
View file

@ -0,0 +1,7 @@
[gd_resource type="Environment" load_steps=2 format=2]
[sub_resource type="ProceduralSky" id=1]
[resource]
background_mode = 2
background_sky = SubResource(1)

BIN
icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

34
icon.png.import Normal file
View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://dnm6uqfxyoew7"
path="res://.godot/imported/icon.png-487276ed1e3a0c39cad0279d744ee560.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://icon.png"
dest_files=["res://.godot/imported/icon.png-487276ed1e3a0c39cad0279d744ee560.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
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/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

66
project.godot Normal file
View file

@ -0,0 +1,66 @@
; Engine configuration file.
; It's best edited using the editor UI and not directly,
; since the parameters that go here are not all obvious.
;
; Format:
; [section] ; section goes between []
; param=value ; assign values to parameters
config_version=5
[application]
config/name="PokemonLike"
config/description="Enter an interesting project description here!"
run/main_scene="uid://bitxjixlf2fcv"
config/features=PackedStringArray("4.4", "C#")
config/icon="res://icon.png"
[autoload]
Globals="*res://Library/Support/Globals.cs"
[dotnet]
project/assembly_name="PokemonLike"
[input]
move_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":65,"key_label":0,"unicode":97,"location":0,"echo":false,"script":null)
, 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)
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":-1,"axis":0,"axis_value":-1.0,"script":null)
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":13,"pressure":0.0,"pressed":true,"script":null)
]
}
move_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":68,"key_label":0,"unicode":100,"location":0,"echo":false,"script":null)
, 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)
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":-1,"axis":0,"axis_value":1.0,"script":null)
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":14,"pressure":0.0,"pressed":true,"script":null)
]
}
move_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":87,"key_label":0,"unicode":119,"location":0,"echo":false,"script":null)
, 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)
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":-1,"axis":1,"axis_value":-1.0,"script":null)
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":11,"pressure":0.0,"pressed":true,"script":null)
]
}
move_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":83,"key_label":0,"unicode":115,"location":0,"echo":false,"script":null)
, 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)
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":-1,"axis":1,"axis_value":1.0,"script":null)
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":12,"pressure":0.0,"pressed":true,"script":null)
]
}
[rendering]
textures/canvas_textures/default_texture_filter=0
textures/decals/filter=0
textures/light_projectors/filter=0