fix font and fix first bug !!

This commit is contained in:
Mylloon 2023-02-26 13:52:50 +01:00
parent 8f920f93b9
commit 82e11bcfb2
Signed by: Anri
GPG key ID: A82D63DFF8D1317F
6 changed files with 38 additions and 6 deletions

View file

@ -0,0 +1,8 @@
[gd_resource type="DynamicFont" load_steps=2 format=2]
[ext_resource path="res://Assets/skin_assets/VCR_OSD_MONO_1.001.ttf" type="DynamicFontData" id=1]
[resource]
size = 20
outline_color = Color( 0.298039, 0.0745098, 0.0745098, 1 )
font_data = ExtResource( 1 )

View file

@ -1,7 +1,8 @@
[gd_scene load_steps=3 format=2] [gd_scene load_steps=4 format=2]
[ext_resource path="res://Assets/dossier/0.png" type="Texture" id=1] [ext_resource path="res://Assets/dossier/0.png" type="Texture" id=1]
[ext_resource path="res://Elements/Scripts/Directory.gd" type="Script" id=2] [ext_resource path="res://Elements/Scripts/Directory.gd" type="Script" id=2]
[ext_resource path="res://Assets/skin_assets/dir_font.tres" type="DynamicFont" id=3]
[node name="Node2D" type="Node2D"] [node name="Node2D" type="Node2D"]
z_index = 3 z_index = 3
@ -16,4 +17,12 @@ script = ExtResource( 2 )
[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="Area2D"] [node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="Area2D"]
polygon = PoolVector2Array( -29, -23, -13, -23, -13, -27, -9, -27, -9, -31, -4, -31, -4, -35, 17, -35, 17, -31, 29, -31, 29, -27, 33, -27, 33, -15, 38, -15, 38, -11, 42, -11, 42, -2, 37, -2, 37, 11, 33, 11, 33, 23, 29, 23, 29, 27, 21, 27, 21, 31, 4, 31, 4, 35, -29, 35, -29, 31, -33, 31, -33, 19, -37, 19, -37, -2, -42, -2, -42, -15, -37, -15, -37, -19, -29, -19 ) polygon = PoolVector2Array( -29, -23, -13, -23, -13, -27, -9, -27, -9, -31, -4, -31, -4, -35, 17, -35, 17, -31, 29, -31, 29, -27, 33, -27, 33, -15, 38, -15, 38, -11, 42, -11, 42, -2, 37, -2, 37, 11, 33, 11, 33, 23, 29, 23, 29, 27, 21, 27, 21, 31, 4, 31, 4, 35, -29, 35, -29, 31, -33, 31, -33, 19, -37, 19, -37, -2, -42, -2, -42, -15, -37, -15, -37, -19, -29, -19 )
[node name="Label" type="Label" parent="."]
margin_left = -42.0
margin_top = 35.0
margin_right = 72.0
margin_bottom = 59.0
custom_fonts/font = ExtResource( 3 )
text = "Dossier"
[connection signal="input_event" from="Area2D" to="Area2D" method="_on_Area2D_input_event"] [connection signal="input_event" from="Area2D" to="Area2D" method="_on_Area2D_input_event"]

View file

@ -1,6 +1,7 @@
extends Area2D extends Area2D
onready var screen = $"../Screen" onready var screen = $"../Screen"
onready var sprite = $"../Sprite"
func _on_Area2D_input_event(_viewport: Node, event: InputEvent, _shape_idx: int) -> void: func _on_Area2D_input_event(_viewport: Node, event: InputEvent, _shape_idx: int) -> void:
@ -8,3 +9,4 @@ func _on_Area2D_input_event(_viewport: Node, event: InputEvent, _shape_idx: int)
event = event as InputEventMouseButton event = event as InputEventMouseButton
if event.pressed and event.button_index == BUTTON_LEFT: if event.pressed and event.button_index == BUTTON_LEFT:
screen.visible = true screen.visible = true
sprite.modulate = Color(0.66, 0.51, 0.85) # shade

View file

@ -4,6 +4,7 @@ var is_dragging = false
var grabbed_offset = Vector2() var grabbed_offset = Vector2()
onready var window = $"../.." onready var window = $"../.."
onready var folder_icon = $"../../../Sprite"
func drag_change_state(): func drag_change_state():
@ -13,7 +14,11 @@ func drag_change_state():
func _process(_delta) -> void: func _process(_delta) -> void:
if is_dragging: if is_dragging:
window.set_position(get_global_mouse_position() + grabbed_offset) var new_pos = get_global_mouse_position() + grabbed_offset
if new_pos.x > 300:
window.set_position(new_pos)
else:
drag_change_state()
func _on_Area2D_input_event(_viewport: Node, event: InputEvent, _shape_idx: int) -> void: func _on_Area2D_input_event(_viewport: Node, event: InputEvent, _shape_idx: int) -> void:
@ -30,4 +35,5 @@ func _on_Area2D2_input_event(_viewport: Node, event: InputEvent, _shape_idx: int
event = event as InputEventMouseButton event = event as InputEventMouseButton
if event.pressed and event.button_index == BUTTON_LEFT: if event.pressed and event.button_index == BUTTON_LEFT:
drag_change_state() drag_change_state()
window.visible = !window.visible window.visible = false
folder_icon.modulate = Color(1, 1, 1) # reset shade

View file

@ -48,4 +48,11 @@ position = Vector2( 73, 147 )
visible = false visible = false
position = Vector2( 396, 195 ) position = Vector2( 396, 195 )
[node name="Directory2" parent="Directories" instance=ExtResource( 2 )]
position = Vector2( 73, 258 )
[node name="Screen" parent="Directories/Directory2" instance=ExtResource( 9 )]
visible = false
position = Vector2( 396, 195 )
[connection signal="pressed" from="Button" to="Button" method="_on_Button_pressed"] [connection signal="pressed" from="Button" to="Button" method="_on_Button_pressed"]

View file

@ -1,11 +1,11 @@
[gd_scene load_steps=7 format=2] [gd_scene load_steps=7 format=2]
[ext_resource path="res://Scenes/Scripts/GameOver.gd" type="Script" id=1] [ext_resource path="res://Scenes/Scripts/GameOver.gd" type="Script" id=1]
[ext_resource path="res://Assets/skin_assets/menu_font.tres" type="DynamicFont" id=2]
[ext_resource path="res://Assets/tres_button/normal.tres" type="StyleBox" id=3] [ext_resource path="res://Assets/tres_button/normal.tres" type="StyleBox" id=3]
[ext_resource path="res://Assets/tres_button/pressed.tres" type="StyleBox" id=4] [ext_resource path="res://Assets/tres_button/pressed.tres" type="StyleBox" id=4]
[ext_resource path="res://Assets/tres_button/hover.tres" type="StyleBox" id=5] [ext_resource path="res://Assets/tres_button/hover.tres" type="StyleBox" id=5]
[ext_resource path="res://Assets/windows/windows.png" type="Texture" id=6] [ext_resource path="res://Assets/windows/windows.png" type="Texture" id=6]
[ext_resource path="res://Assets/skin_assets/menu_font.tres" type="DynamicFont" id=7]
[node name="Node2D" type="Node2D"] [node name="Node2D" type="Node2D"]
script = ExtResource( 1 ) script = ExtResource( 1 )
@ -21,7 +21,7 @@ margin_top = 338.0
margin_right = 609.0 margin_right = 609.0
margin_bottom = 368.0 margin_bottom = 368.0
custom_colors/font_color = Color( 0, 0, 0, 1 ) custom_colors/font_color = Color( 0, 0, 0, 1 )
custom_fonts/font = ExtResource( 2 ) custom_fonts/font = ExtResource( 7 )
text = "GAME OVER" text = "GAME OVER"
[node name="RestartButton" type="Button" parent="."] [node name="RestartButton" type="Button" parent="."]
@ -31,7 +31,7 @@ margin_right = 724.0
margin_bottom = 445.0 margin_bottom = 445.0
custom_colors/font_color = Color( 1, 1, 1, 1 ) custom_colors/font_color = Color( 1, 1, 1, 1 )
custom_colors/font_color_hover = Color( 0.941176, 0.690196, 0.403922, 1 ) custom_colors/font_color_hover = Color( 0.941176, 0.690196, 0.403922, 1 )
custom_fonts/font = ExtResource( 2 ) custom_fonts/font = ExtResource( 7 )
custom_styles/hover = ExtResource( 5 ) custom_styles/hover = ExtResource( 5 )
custom_styles/pressed = ExtResource( 4 ) custom_styles/pressed = ExtResource( 4 )
custom_styles/normal = ExtResource( 3 ) custom_styles/normal = ExtResource( 3 )