Resolving ties godot

This commit is contained in:
Raj Hazarika
2023-03-26 12:50:49 -06:00
parent 83ab1f1c4b
commit c8026da752
19 changed files with 288 additions and 1 deletions

View File

@ -0,0 +1,3 @@
source_md5="47313fa4c47a9963fddd764e1ec6e4a8"
dest_md5="26ea799ea0a3da9e753b3ebe822e0570"

View File

@ -0,0 +1,3 @@
source_md5="2eb54d6ac44db53e8106f751e45aed19"
dest_md5="4b796a044249f0d6f7ff4a9ab8d2aa30"

View File

@ -0,0 +1,3 @@
source_md5="7c98aa1222760d456e98e1fd72ee6945"
dest_md5="5360d0080ae3dbe14545acc0a4826ffd"

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

View File

@ -0,0 +1,35 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/icons8-reset-50.png-71e4ab05e2ac56cb1c906522bba8befc.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://Assets/icons8-reset-50.png"
dest_files=[ "res://.import/icons8-reset-50.png-71e4ab05e2ac56cb1c906522bba8befc.stex" ]
[params]
compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=true
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
process/normal_map_invert_y=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

View File

@ -0,0 +1,35 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/ok-button.png-99534f8614d55282ebd043cd5e696357.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://Assets/ok-button.png"
dest_files=[ "res://.import/ok-button.png-99534f8614d55282ebd043cd5e696357.stex" ]
[params]
compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=true
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
process/normal_map_invert_y=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0

View File

@ -0,0 +1,99 @@
[gd_scene load_steps=4 format=2]
[ext_resource path="res://Script/Resolve.gd" type="Script" id=1]
[ext_resource path="res://Assets/ok-button.png" type="Texture" id=2]
[ext_resource path="res://Assets/icons8-reset-50.png" type="Texture" id=3]
[node name="Resolve" type="Control"]
anchor_right = 1.0
anchor_bottom = 1.0
script = ExtResource( 1 )
[node name="ColorRect" type="ColorRect" parent="."]
margin_right = 1024.0
margin_bottom = 600.0
color = Color( 0, 0, 0, 0.380392 )
[node name="Player1" type="TextureRect" parent="."]
margin_right = 40.0
margin_bottom = 40.0
[node name="RichTextLabel" type="RichTextLabel" parent="Player1"]
margin_left = 159.0
margin_top = 174.0
margin_right = 212.0
margin_bottom = 191.0
text = "Player 1"
[node name="TextureButton1" type="TextureButton" parent="Player1"]
margin_left = 150.0
margin_top = 220.0
margin_right = 230.0
margin_bottom = 286.0
texture_normal = ExtResource( 2 )
texture_pressed = ExtResource( 2 )
expand = true
[node name="LineEdit" type="LineEdit" parent="Player1"]
margin_left = 120.0
margin_top = 200.0
margin_right = 250.0
margin_bottom = 225.0
placeholder_text = "Enter stats"
[node name="Player2" type="TextureRect" parent="."]
margin_right = 40.0
margin_bottom = 40.0
[node name="RichTextLabel" type="RichTextLabel" parent="Player2"]
margin_left = 841.0
margin_top = 176.0
margin_right = 895.0
margin_bottom = 194.0
text = "Player 2"
[node name="TextureButton2" type="TextureButton" parent="Player2"]
margin_left = 825.0
margin_top = 220.0
margin_right = 905.0
margin_bottom = 286.0
texture_normal = ExtResource( 2 )
texture_pressed = ExtResource( 2 )
expand = true
[node name="LineEdit" type="LineEdit" parent="Player2"]
margin_left = 800.0
margin_top = 200.0
margin_right = 930.0
margin_bottom = 225.0
placeholder_text = "Enter stats"
[node name="Result" type="ColorRect" parent="."]
visible = false
margin_left = 348.0
margin_top = 337.0
margin_right = 752.0
margin_bottom = 431.0
color = Color( 0.368627, 0.32549, 0.32549, 0.560784 )
[node name="RichTextLabel" type="RichTextLabel" parent="Result"]
anchor_top = 0.5
anchor_right = 1.0
anchor_bottom = 0.5
margin_left = 158.0
margin_top = -18.0
margin_right = -154.0
[node name="ResetButton" type="TextureButton" parent="."]
anchor_left = 0.5
anchor_right = 0.5
margin_left = -25.0
margin_top = 200.0
margin_right = 25.0
margin_bottom = 250.0
texture_normal = ExtResource( 3 )
texture_pressed = ExtResource( 3 )
[connection signal="pressed" from="Player1/TextureButton1" to="." method="_on_TextureButton1_pressed"]
[connection signal="pressed" from="Player2/TextureButton2" to="." method="_on_TextureButton2_pressed"]
[connection signal="pressed" from="ResetButton" to="." method="_on_ResetButton_pressed"]

View File

@ -0,0 +1,40 @@
extends Control
onready var player_1_stats = 0
onready var player_2_stats = 0
onready var line_edit_1 = $Player1/LineEdit
onready var line_edit_2 = $Player2/LineEdit
onready var result = $Result
func _ready():
line_edit_1.grab_focus()
func _physics_process(delta):
if player_1_stats != 0 and player_2_stats != 0 and !result.is_visible_in_tree():
if player_1_stats > player_2_stats:
$Result/RichTextLabel.add_text("Player 1 wins!")
$Result.visible = true
elif player_2_stats > player_1_stats:
$Result/RichTextLabel.add_text("Player 2 wins!")
$Result.visible = true
else:
$Result/RichTextLabel.add_text("Re-roll!")
$Result.visible = true
func _on_TextureButton1_pressed():
player_1_stats = int(line_edit_1.text)
func _on_TextureButton2_pressed():
player_2_stats = int(line_edit_2.text)
func _on_ResetButton_pressed():
player_1_stats = 0
player_2_stats = 0
line_edit_1.clear()
line_edit_2.clear()
$Result/RichTextLabel.clear()
result.visible = false

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 )

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

View File

@ -0,0 +1,35 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/icon.png-487276ed1e3a0c39cad0279d744ee560.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://icon.png"
dest_files=[ "res://.import/icon.png-487276ed1e3a0c39cad0279d744ee560.stex" ]
[params]
compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=true
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
process/normal_map_invert_y=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0

View File

@ -0,0 +1,26 @@
; 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=4
[application]
config/name="ResolvingTies"
config/icon="res://icon.png"
[gui]
common/drop_mouse_on_gui_input_disabled=true
[physics]
common/enable_pause_aware_picking=true
[rendering]
environment/default_environment="res://default_env.tres"