1
0
Fork 0
mirror of https://github.com/tonytins/dressupzack synced 2025-05-07 14:04:48 -04:00

Further streamlined functionality

This commit is contained in:
Anthony Wilcox 2019-06-10 21:38:57 -04:00
parent f7e6cfa3c3
commit 20da3fde06
3 changed files with 34 additions and 14 deletions

View file

@ -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"> <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup> <PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
@ -50,7 +50,6 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="src\ClothingType.cs" />
<Compile Include="src\GameScn.cs" /> <Compile Include="src\GameScn.cs" />
<Compile Include="src\Soundtrack.cs" /> <Compile Include="src\Soundtrack.cs" />
<Compile Include="src\TitleScn.cs" /> <Compile Include="src\TitleScn.cs" />

View file

@ -57,6 +57,7 @@ animations = [ {
[node name="Tail" type="AnimatedSprite" parent="Base"] [node name="Tail" type="AnimatedSprite" parent="Base"]
position = Vector2( 54.4027, 184.439 ) position = Vector2( 54.4027, 184.439 )
frames = SubResource( 1 ) frames = SubResource( 1 )
frame = 5
playing = true playing = true
[node name="Nathan" type="Sprite" parent="Base"] [node name="Nathan" type="Sprite" parent="Base"]
@ -66,13 +67,13 @@ texture = ExtResource( 4 )
[node name="Eyes" type="AnimatedSprite" parent="Base"] [node name="Eyes" type="AnimatedSprite" parent="Base"]
position = Vector2( 114.227, 63.9224 ) position = Vector2( 114.227, 63.9224 )
frames = SubResource( 2 ) frames = SubResource( 2 )
frame = 6 frame = 1
playing = true playing = true
[node name="Mouth" type="AnimatedSprite" parent="Base"] [node name="Mouth" type="AnimatedSprite" parent="Base"]
position = Vector2( 131.024, 67.4964 ) position = Vector2( 131.024, 67.4964 )
frames = SubResource( 3 ) frames = SubResource( 3 )
frame = 4 frame = 23
playing = true playing = true
[node name="Undies" type="Sprite" parent="."] [node name="Undies" type="Sprite" parent="."]

View file

@ -2,8 +2,9 @@ using Godot;
public enum ClothingType public enum ClothingType
{ {
Top, Shirts,
Bottom, Pants,
Undies,
Accessory Accessory
} }
@ -11,18 +12,22 @@ public class GameScn : Node
{ {
void ChangeClothes(string path, ClothingType clothingType) void ChangeClothes(string path, ClothingType clothingType)
{ {
var texture = ResourceLoader.Load<Texture>(path); var texture = ResourceLoader.Load<Texture>($"res://{path}");
switch (clothingType) switch (clothingType)
{ {
case ClothingType.Top: case ClothingType.Shirts:
var top = GetNode<Sprite>("Nathan/Accessory"); var top = GetNode<Sprite>("Nathan/Top");
top.Texture = texture; top.Texture = texture;
break; break;
case ClothingType.Bottom: case ClothingType.Pants:
var bottom = GetNode<Sprite>("Nathan/Accessory"); var bottom = GetNode<Sprite>("Nathan/Bottom");
bottom.Texture = texture; bottom.Texture = texture;
break; break;
case ClothingType.Undies:
var undies = GetNode<Sprite>("Nathan/Undies");
undies.Texture = texture;
break;
case ClothingType.Accessory: case ClothingType.Accessory:
var accessory = GetNode<Sprite>("Nathan/Accessory"); var accessory = GetNode<Sprite>("Nathan/Accessory");
accessory.Texture = texture; 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) public override void _Process(float delta)
{ {
// Change clothes // Change clothes
if (GetNode<TextureButton>("Clothes/Wordrobe/Accessoires/AccsGrid/CanonCam").IsPressed()) if (ClothingButton("CanonCam", ClothingType.Accessory).IsPressed())
ChangeClothes("res://sprites/camera.png", ClothingType.Accessory); ChangeClothes("sprites/camera.png", ClothingType.Accessory);
} }
} }