From ed794b26f2c0bc1704b441e10f15ce15126cb500 Mon Sep 17 00:00:00 2001 From: akshay Date: Sun, 21 Aug 2022 11:16:53 -0400 Subject: [PATCH] Updated stomach texture --- scenes/game_manager.tscn | 58 ++++++++++++++++------- scenes/main.tscn | 8 ++-- scenes/player.tscn | 80 +++++++++++++++++++------------- scripts/player/state/sleeping.gd | 2 + shaders/circlewipe.gdshader | 2 +- 5 files changed, 98 insertions(+), 52 deletions(-) diff --git a/scenes/game_manager.tscn b/scenes/game_manager.tscn index 06b916e..bd00dbd 100644 --- a/scenes/game_manager.tscn +++ b/scenes/game_manager.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=9 format=2] +[gd_scene load_steps=11 format=2] [ext_resource path="res://scripts/game_manager.gd" type="Script" id=1] [ext_resource path="res://assets/UI/Menu_Recipes.png" type="Texture" id=2] @@ -6,6 +6,14 @@ [ext_resource path="res://assets/Fonts/AlphaProta-Wy7VE.ttf" type="DynamicFontData" id=4] [ext_resource path="res://assets/UI/Timers.png" type="Texture" id=5] +[sub_resource type="Gradient" id=22] +offsets = PoolRealArray( 0, 0.776119, 1 ) +colors = PoolColorArray( 0, 0, 0, 1, 0, 0, 0, 0.429105, 0, 0, 0, 0 ) + +[sub_resource type="GradientTexture2D" id=21] +gradient = SubResource( 22 ) +fill_to = Vector2( 0, 1 ) + [sub_resource type="DynamicFont" id=2] size = 50 font_data = ExtResource( 4 ) @@ -20,7 +28,7 @@ font_data = ExtResource( 4 ) [node name="game_manager" type="CanvasLayer" groups=["game_manager"]] pause_mode = 2 -layer = 5 +layer = 3 script = ExtResource( 1 ) [node name="UI" type="Control" parent="."] @@ -30,6 +38,18 @@ rect_pivot_offset = Vector2( 1024, 600 ) size_flags_horizontal = 3 size_flags_vertical = 3 +[node name="TextureRect" type="TextureRect" parent="UI"] +anchor_left = 0.5 +anchor_right = 1.0 +anchor_bottom = 0.117593 +mouse_filter = 2 +texture = SubResource( 21 ) +expand = true +stretch_mode = 1 +__meta__ = { +"_edit_use_anchors_": true +} + [node name="pause_menu" type="Panel" parent="UI"] pause_mode = 2 unique_name_in_owner = true @@ -100,20 +120,22 @@ icon_align = 1 expand_icon = true [node name="HUD" type="TextureRect" parent="UI"] -anchor_left = 1.0 +anchor_left = 0.610937 +anchor_top = -0.00740741 anchor_right = 1.0 -margin_left = -747.0 -margin_top = -8.0 -margin_bottom = 137.0 +anchor_bottom = 0.126852 texture = ExtResource( 5 ) +expand = true +__meta__ = { +"_edit_use_anchors_": true +} [node name="day_timer_text" type="Label" parent="UI/HUD"] unique_name_in_owner = true -anchor_left = 1.0 +anchor_left = 0.73494 +anchor_top = 0.0551724 anchor_right = 1.0 -margin_left = -198.0 -margin_top = 8.0 -margin_bottom = 84.0 +anchor_bottom = 0.57931 grow_horizontal = 0 rect_pivot_offset = Vector2( 116.901, -0.362253 ) custom_colors/font_color = Color( 0.0235294, 0.792157, 0, 1 ) @@ -126,15 +148,16 @@ text = "00:20" align = 1 valign = 1 uppercase = true +__meta__ = { +"_edit_use_anchors_": true +} [node name="current_coins_text" type="Label" parent="UI/HUD"] unique_name_in_owner = true -anchor_left = 1.0 -anchor_right = 1.0 -margin_left = -94.0 -margin_top = 95.0 -margin_right = -20.0 -margin_bottom = 130.0 +anchor_left = 0.874163 +anchor_top = 0.655172 +anchor_right = 0.973226 +anchor_bottom = 0.896552 grow_horizontal = 0 rect_pivot_offset = Vector2( 116.901, -0.362253 ) custom_colors/font_color = Color( 0.0235294, 0.792157, 0, 1 ) @@ -147,6 +170,9 @@ text = "0" align = 1 valign = 1 uppercase = true +__meta__ = { +"_edit_use_anchors_": true +} [node name="day_timer" type="Timer" parent="."] pause_mode = 1 diff --git a/scenes/main.tscn b/scenes/main.tscn index e4b9689..72b202c 100644 --- a/scenes/main.tscn +++ b/scenes/main.tscn @@ -84,6 +84,9 @@ adjustment_contrast = 1.97 [node name="main" type="Spatial"] +[node name="game_manager" parent="." instance=ExtResource( 7 )] +time_per_day = 300.0 + [node name="Level" parent="." instance=ExtResource( 1 )] __meta__ = { "_edit_group_": true @@ -100,6 +103,8 @@ transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 4.35996 ) hunger_tick_time = 75.0 [node name="cameras" type="Spatial" parent="."] +pause_mode = 2 +physics_interpolation_mode = 2 script = ExtResource( 2 ) target = NodePath("../Player") camera_lerp = 0.0 @@ -415,9 +420,6 @@ pause_mode = 1 [node name="cheat_menu" parent="CanvasLayer" instance=ExtResource( 18 )] -[node name="game_manager" parent="." instance=ExtResource( 7 )] -time_per_day = 300.0 - [connection signal="player_entered" from="cameras/camera_room_center" to="cameras" method="_on_camera_room_player_entered"] [connection signal="player_exited" from="cameras/camera_room_center" to="cameras" method="_on_camera_room_player_exited"] [connection signal="area_entered" from="cameras/camera_room_center/hitbox" to="cameras/camera_room_center" method="_on_hitbox_area_entered"] diff --git a/scenes/player.tscn b/scenes/player.tscn index c6052f9..37ddfa6 100644 --- a/scenes/player.tscn +++ b/scenes/player.tscn @@ -1,10 +1,11 @@ -[gd_scene load_steps=35 format=2] +[gd_scene load_steps=37 format=2] [ext_resource path="res://scripts/player/player.gd" type="Script" id=1] [ext_resource path="res://assets/dungman/DungMan.tscn" type="PackedScene" id=2] -[ext_resource path="res://assets/icons/stomach.png" type="Texture" id=3] +[ext_resource path="res://assets/Fonts/AlphaProta-Wy7VE.ttf" type="DynamicFontData" id=3] [ext_resource path="res://assets/dungman/Dungee_MAT.material" type="Material" id=4] [ext_resource path="res://shaders/circlewipe.gdshader" type="Shader" id=5] +[ext_resource path="res://assets/UI/Icon_Stomach.png" type="Texture" id=6] [sub_resource type="ArrayMesh" id=1] resource_name = "DungMan_Mesh" @@ -676,12 +677,12 @@ tracks/2/keys = { radius = 0.535552 height = 0.565073 -[sub_resource type="Gradient" id=20] +[sub_resource type="Gradient" id=32] offsets = PoolRealArray( 0, 0.776119, 1 ) colors = PoolColorArray( 0, 0, 0, 1, 0, 0, 0, 0.429105, 0, 0, 0, 0 ) -[sub_resource type="GradientTexture2D" id=21] -gradient = SubResource( 20 ) +[sub_resource type="GradientTexture2D" id=33] +gradient = SubResource( 32 ) fill_to = Vector2( 0, 1 ) [sub_resource type="ShaderMaterial" id=28] @@ -700,6 +701,10 @@ shader_param/percent = 0.0 shader = ExtResource( 5 ) shader_param/percent = 0.31 +[sub_resource type="DynamicFont" id=34] +size = 30 +font_data = ExtResource( 3 ) + [node name="Player" type="KinematicBody" groups=["player"]] axis_lock_motion_y = true move_lock_y = true @@ -709,12 +714,15 @@ script = ExtResource( 1 ) [node name="DungMan" parent="model_transform" instance=ExtResource( 2 )] +[node name="Skeleton" parent="model_transform/DungMan/Armature" index="0"] +bones/7/bound_children = [ NodePath("head_bone") ] + [node name="Dungee" parent="model_transform/DungMan/Armature/Skeleton" index="0"] mesh = SubResource( 1 ) skin = SubResource( 2 ) [node name="head_bone" type="BoneAttachment" parent="model_transform/DungMan/Armature/Skeleton" index="1"] -transform = Transform( 1, -2.215e-16, -8.74829e-18, 1.05956e-18, -0.0346883, 0.999398, -2.21671e-16, -0.999398, -0.0346883, -3.32827e-16, -0.0101955, -1.49897 ) +transform = Transform( 1, -2.2206e-16, -1.42702e-19, -4.51773e-20, -0.000846088, 1, -2.2206e-16, -1, -0.000846088, -3.33339e-16, 0.00914785, -1.49698 ) bone_name = "Item" [node name="ItemSpawn" type="Spatial" parent="model_transform/DungMan/Armature/Skeleton/head_bone"] @@ -770,20 +778,27 @@ shape = SubResource( 19 ) [node name="UI" type="CanvasLayer" parent="."] pause_mode = 2 +layer = 2 [node name="Control" type="Control" parent="UI"] -margin_right = 40.0 -margin_bottom = 40.0 +anchor_right = 1.0 +anchor_bottom = 1.0 mouse_filter = 2 [node name="TextureRect" type="TextureRect" parent="UI/Control"] -margin_right = 565.0 -margin_bottom = 164.0 +anchor_right = 0.5 +anchor_bottom = 0.117593 mouse_filter = 2 -texture = SubResource( 21 ) +texture = SubResource( 33 ) expand = true +stretch_mode = 1 +__meta__ = { +"_edit_use_anchors_": true +} [node name="MarginContainer" type="MarginContainer" parent="UI/Control"] +margin_right = 592.0 +margin_bottom = 169.0 mouse_filter = 2 custom_constants/margin_right = 16 custom_constants/margin_top = 16 @@ -794,44 +809,44 @@ custom_constants/margin_bottom = 16 unique_name_in_owner = true margin_left = 16.0 margin_top = 16.0 -margin_right = 540.0 -margin_bottom = 144.0 +margin_right = 576.0 +margin_bottom = 153.0 mouse_filter = 2 [node name="stomach0" type="TextureRect" parent="UI/Control/MarginContainer/stomachs"] material = SubResource( 28 ) -margin_right = 128.0 -margin_bottom = 128.0 +margin_right = 137.0 +margin_bottom = 137.0 rect_pivot_offset = Vector2( 128, 821 ) mouse_filter = 2 -texture = ExtResource( 3 ) +texture = ExtResource( 6 ) [node name="stomach1" type="TextureRect" parent="UI/Control/MarginContainer/stomachs"] material = SubResource( 29 ) -margin_left = 132.0 -margin_right = 260.0 -margin_bottom = 128.0 +margin_left = 141.0 +margin_right = 278.0 +margin_bottom = 137.0 rect_pivot_offset = Vector2( 128, 821 ) mouse_filter = 2 -texture = ExtResource( 3 ) +texture = ExtResource( 6 ) [node name="stomach2" type="TextureRect" parent="UI/Control/MarginContainer/stomachs"] material = SubResource( 30 ) -margin_left = 264.0 -margin_right = 392.0 -margin_bottom = 128.0 +margin_left = 282.0 +margin_right = 419.0 +margin_bottom = 137.0 rect_pivot_offset = Vector2( 128, 821 ) mouse_filter = 2 -texture = ExtResource( 3 ) +texture = ExtResource( 6 ) [node name="stomach3" type="TextureRect" parent="UI/Control/MarginContainer/stomachs"] material = SubResource( 31 ) -margin_left = 396.0 -margin_right = 524.0 -margin_bottom = 128.0 +margin_left = 423.0 +margin_right = 560.0 +margin_bottom = 137.0 rect_pivot_offset = Vector2( 128, 821 ) mouse_filter = 2 -texture = ExtResource( 3 ) +texture = ExtResource( 6 ) [node name="blackout" type="ColorRect" parent="UI"] modulate = Color( 1, 1, 1, 0 ) @@ -846,11 +861,12 @@ anchor_left = 0.5 anchor_top = 0.5 anchor_right = 0.5 anchor_bottom = 0.5 -margin_left = -90.0 -margin_top = -20.0 -margin_right = 90.0 -margin_bottom = 20.0 +margin_left = -382.0 +margin_top = -45.0 +margin_right = 389.0 +margin_bottom = 54.0 custom_colors/font_color = Color( 1, 1, 1, 1 ) +custom_fonts/font = SubResource( 34 ) text = "ZZZZZZZZZZZZZ Press the action input to continue..." diff --git a/scripts/player/state/sleeping.gd b/scripts/player/state/sleeping.gd index 0ddd7f2..dfff053 100644 --- a/scripts/player/state/sleeping.gd +++ b/scripts/player/state/sleeping.gd @@ -53,6 +53,8 @@ func enter_from(state): model_transform.global_transform = hop_position.global_transform old_model_origin = model_transform.global_transform.origin + #UGLY CODE - but works + ctx.get_node("/root/main/cameras").set_current_camera(ctx.get_node("/root/main/cameras/camera_room_bedroom/camera")) # Play hop animation ctx.get_node("model_transform/DungMan/AnimationTree")["parameters/Move/playback"].travel("idle") diff --git a/shaders/circlewipe.gdshader b/shaders/circlewipe.gdshader index 0023ca9..d20fabd 100644 --- a/shaders/circlewipe.gdshader +++ b/shaders/circlewipe.gdshader @@ -15,5 +15,5 @@ void fragment() { float angle = atan2((UV.y - 0.5) , (UV.x - 0.5)); float alpha = step(percent * 3.14159 * 2.25, angle + 3.14159); vec4 color = texture(TEXTURE, UV); - COLOR = vec4(color.rgb, 1.0); + COLOR = vec4(color.rgb, color.a * alpha); } \ No newline at end of file