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

Tweaked button and changing functions

This commit is contained in:
Anthony Wilcox 2019-06-10 21:59:30 -04:00
parent 20da3fde06
commit d3210f352e
4 changed files with 18 additions and 15 deletions

View file

@ -57,7 +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 frame = 8
playing = true playing = true
[node name="Nathan" type="Sprite" parent="Base"] [node name="Nathan" type="Sprite" parent="Base"]
@ -67,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 = 1 frame = 13
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 = 23 frame = 2
playing = true playing = true
[node name="Undies" type="Sprite" parent="."] [node name="Undies" type="Sprite" parent="."]

View file

@ -39,7 +39,6 @@ custom_colors/font_color_bg = Color( 0.921569, 0.921569, 0.921569, 1 )
custom_colors/font_color_fg = Color( 1, 1, 1, 1 ) custom_colors/font_color_fg = Color( 1, 1, 1, 1 )
[node name="Pants" type="Tabs" parent="Wordrobe"] [node name="Pants" type="Tabs" parent="Wordrobe"]
visible = false
anchor_right = 1.0 anchor_right = 1.0
anchor_bottom = 1.0 anchor_bottom = 1.0
margin_top = 31.0 margin_top = 31.0
@ -76,9 +75,9 @@ margin_bottom = 112.0
texture_normal = ExtResource( 6 ) texture_normal = ExtResource( 6 )
[node name="RemovePants" type="Button" parent="Wordrobe/Pants/PantsGrid"] [node name="RemovePants" type="Button" parent="Wordrobe/Pants/PantsGrid"]
margin_top = 116.0 margin_left = 440.0
margin_right = 106.0 margin_right = 546.0
margin_bottom = 228.0 margin_bottom = 112.0
rect_min_size = Vector2( 0, 112 ) rect_min_size = Vector2( 0, 112 )
custom_colors/font_color_disabled = Color( 0, 0, 0, 1 ) custom_colors/font_color_disabled = Color( 0, 0, 0, 1 )
custom_colors/font_color = Color( 0, 0, 0, 1 ) custom_colors/font_color = Color( 0, 0, 0, 1 )
@ -88,6 +87,7 @@ icon = ExtResource( 7 )
flat = true flat = true
[node name="Shirts" type="Tabs" parent="Wordrobe"] [node name="Shirts" type="Tabs" parent="Wordrobe"]
visible = false
anchor_right = 1.0 anchor_right = 1.0
anchor_bottom = 1.0 anchor_bottom = 1.0
margin_top = 31.0 margin_top = 31.0
@ -204,7 +204,6 @@ margin_bottom = 112.0
texture_normal = ExtResource( 20 ) texture_normal = ExtResource( 20 )
[node name="Accessoires" type="Tabs" parent="Wordrobe"] [node name="Accessoires" type="Tabs" parent="Wordrobe"]
editor/display_folded = true
visible = false visible = false
anchor_right = 1.0 anchor_right = 1.0
anchor_bottom = 1.0 anchor_bottom = 1.0

View file

@ -12,7 +12,7 @@ public class GameScn : Node
{ {
void ChangeClothes(string path, ClothingType clothingType) void ChangeClothes(string path, ClothingType clothingType)
{ {
var texture = ResourceLoader.Load<Texture>($"res://{path}"); var texture = ResourceLoader.Load<Texture>($"res://sprites/{path}");
switch (clothingType) switch (clothingType)
{ {
@ -35,7 +35,7 @@ public class GameScn : Node
} }
} }
TextureButton ClothingButton(string path, ClothingType clothingType) TextureButton ClothesButton(string path, ClothingType clothingType)
{ {
switch (clothingType) switch (clothingType)
{ {
@ -53,8 +53,12 @@ public class GameScn : Node
public override void _Process(float delta) public override void _Process(float delta)
{ {
// Change clothes // Accessories
if (ClothingButton("CanonCam", ClothingType.Accessory).IsPressed()) if (ClothesButton("CanonCam", ClothingType.Accessory).Pressed)
ChangeClothes("sprites/camera.png", ClothingType.Accessory); ChangeClothes("camera.png", ClothingType.Accessory);
// Pants
if (ClothesButton("Jeans", ClothingType.Pants).Pressed)
ChangeClothes("jeans.svg", ClothingType.Pants);
} }
} }

View file

@ -4,11 +4,11 @@ using Godot;
public class TitleScn : Node { public class TitleScn : Node {
void _on_PlayBtn_pressed() { void _on_PlayBtn_pressed() {
GetTree ().ChangeScene ("res://scn/GameScn.tscn"); GetTree().ChangeScene("res://scn/GameScn.tscn");
} }
void _on_CreditsBtn_pressed() { void _on_CreditsBtn_pressed() {
GetTree ().ChangeScene ("res://scn/CreditsScn.tscn"); GetTree().ChangeScene("res://scn/CreditsScn.tscn");
} }
void _on_LicenseBtn_pressed() { void _on_LicenseBtn_pressed() {