mirror of
https://github.com/tonytins/dressupzack
synced 2025-05-06 21:54:48 -04:00
Further streamlined functionality
This commit is contained in:
parent
f7e6cfa3c3
commit
20da3fde06
3 changed files with 34 additions and 14 deletions
|
@ -1,4 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
|
@ -50,7 +50,6 @@
|
|||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="src\ClothingType.cs" />
|
||||
<Compile Include="src\GameScn.cs" />
|
||||
<Compile Include="src\Soundtrack.cs" />
|
||||
<Compile Include="src\TitleScn.cs" />
|
||||
|
|
|
@ -57,6 +57,7 @@ animations = [ {
|
|||
[node name="Tail" type="AnimatedSprite" parent="Base"]
|
||||
position = Vector2( 54.4027, 184.439 )
|
||||
frames = SubResource( 1 )
|
||||
frame = 5
|
||||
playing = true
|
||||
|
||||
[node name="Nathan" type="Sprite" parent="Base"]
|
||||
|
@ -66,13 +67,13 @@ texture = ExtResource( 4 )
|
|||
[node name="Eyes" type="AnimatedSprite" parent="Base"]
|
||||
position = Vector2( 114.227, 63.9224 )
|
||||
frames = SubResource( 2 )
|
||||
frame = 6
|
||||
frame = 1
|
||||
playing = true
|
||||
|
||||
[node name="Mouth" type="AnimatedSprite" parent="Base"]
|
||||
position = Vector2( 131.024, 67.4964 )
|
||||
frames = SubResource( 3 )
|
||||
frame = 4
|
||||
frame = 23
|
||||
playing = true
|
||||
|
||||
[node name="Undies" type="Sprite" parent="."]
|
||||
|
|
|
@ -2,8 +2,9 @@ using Godot;
|
|||
|
||||
public enum ClothingType
|
||||
{
|
||||
Top,
|
||||
Bottom,
|
||||
Shirts,
|
||||
Pants,
|
||||
Undies,
|
||||
Accessory
|
||||
}
|
||||
|
||||
|
@ -11,18 +12,22 @@ public class GameScn : Node
|
|||
{
|
||||
void ChangeClothes(string path, ClothingType clothingType)
|
||||
{
|
||||
var texture = ResourceLoader.Load<Texture>(path);
|
||||
var texture = ResourceLoader.Load<Texture>($"res://{path}");
|
||||
|
||||
switch (clothingType)
|
||||
{
|
||||
case ClothingType.Top:
|
||||
var top = GetNode<Sprite>("Nathan/Accessory");
|
||||
case ClothingType.Shirts:
|
||||
var top = GetNode<Sprite>("Nathan/Top");
|
||||
top.Texture = texture;
|
||||
break;
|
||||
case ClothingType.Bottom:
|
||||
var bottom = GetNode<Sprite>("Nathan/Accessory");
|
||||
case ClothingType.Pants:
|
||||
var bottom = GetNode<Sprite>("Nathan/Bottom");
|
||||
bottom.Texture = texture;
|
||||
break;
|
||||
case ClothingType.Undies:
|
||||
var undies = GetNode<Sprite>("Nathan/Undies");
|
||||
undies.Texture = texture;
|
||||
break;
|
||||
case ClothingType.Accessory:
|
||||
var accessory = GetNode<Sprite>("Nathan/Accessory");
|
||||
accessory.Texture = texture;
|
||||
|
@ -30,11 +35,26 @@ public class GameScn : Node
|
|||
}
|
||||
}
|
||||
|
||||
TextureButton ClothingButton(string path, ClothingType clothingType)
|
||||
{
|
||||
switch (clothingType)
|
||||
{
|
||||
case ClothingType.Accessory:
|
||||
return GetNode<TextureButton>($"Clothes/Wordrobe/AccsGrid/{path}");
|
||||
case ClothingType.Undies:
|
||||
return GetNode<TextureButton>($"Clothes/Wordrobe/UndiesGrid/{path}");
|
||||
default:
|
||||
case ClothingType.Pants:
|
||||
return GetNode<TextureButton>($"Clothes/Wordrobe/PantsGrid/{path}");
|
||||
case ClothingType.Shirts:
|
||||
return GetNode<TextureButton>($"Clothes/Wordrobe/ShirtsGrid/{path}");
|
||||
}
|
||||
}
|
||||
|
||||
public override void _Process(float delta)
|
||||
{
|
||||
// Change clothes
|
||||
if (GetNode<TextureButton>("Clothes/Wordrobe/Accessoires/AccsGrid/CanonCam").IsPressed())
|
||||
ChangeClothes("res://sprites/camera.png", ClothingType.Accessory);
|
||||
|
||||
if (ClothingButton("CanonCam", ClothingType.Accessory).IsPressed())
|
||||
ChangeClothes("sprites/camera.png", ClothingType.Accessory);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue