diff options
-rw-r--r-- | .import/blauuu.png-22949d4eb9161508bb9aa3294d24b7e6.md5 | 3 | ||||
-rw-r--r-- | .import/blauuu.png-22949d4eb9161508bb9aa3294d24b7e6.stex | bin | 0 -> 1436 bytes | |||
-rw-r--r-- | components/HackButton.gd | 27 | ||||
-rw-r--r-- | components/HackButton.tscn | 23 | ||||
-rw-r--r-- | hackingscene.gd | 9 | ||||
-rw-r--r-- | hackingscene.tscn | 15 | ||||
-rw-r--r-- | textures/blauuu.png | bin | 0 -> 1534 bytes | |||
-rw-r--r-- | textures/blauuu.png.import | 34 |
8 files changed, 107 insertions, 4 deletions
diff --git a/.import/blauuu.png-22949d4eb9161508bb9aa3294d24b7e6.md5 b/.import/blauuu.png-22949d4eb9161508bb9aa3294d24b7e6.md5 new file mode 100644 index 0000000..f1387dd --- /dev/null +++ b/.import/blauuu.png-22949d4eb9161508bb9aa3294d24b7e6.md5 @@ -0,0 +1,3 @@ +source_md5="2bd9731c263cb3cf164abbcf344c60f3" +dest_md5="1086a611316e4ad786a4d134111726b2" + diff --git a/.import/blauuu.png-22949d4eb9161508bb9aa3294d24b7e6.stex b/.import/blauuu.png-22949d4eb9161508bb9aa3294d24b7e6.stex Binary files differnew file mode 100644 index 0000000..11c4463 --- /dev/null +++ b/.import/blauuu.png-22949d4eb9161508bb9aa3294d24b7e6.stex diff --git a/components/HackButton.gd b/components/HackButton.gd new file mode 100644 index 0000000..9dc1b30 --- /dev/null +++ b/components/HackButton.gd @@ -0,0 +1,27 @@ +extends Area2D + +signal on_click() + +var is_hovered = false + +onready var sprite : Sprite = $Sprite +export(String, FILE, '*.png') var hovered_texture = "res://textures/blauuu.png" +onready var _hovered_texture : Texture = load(hovered_texture) +onready var _default_texture : Texture = sprite.texture + +func _on_HackButton_mouse_entered(): + is_hovered = true + sprite.texture = _hovered_texture + +func _on_HackButton_mouse_exited(): + is_hovered = false + sprite.texture = _default_texture + + +func _on_HackButton_input_event(viewport, event, shape_idx): + if not (event is InputEventMouseButton): + return + if not event.pressed: + return + emit_signal("on_click") + diff --git a/components/HackButton.tscn b/components/HackButton.tscn new file mode 100644 index 0000000..afafb61 --- /dev/null +++ b/components/HackButton.tscn @@ -0,0 +1,23 @@ +[gd_scene load_steps=4 format=2] + +[ext_resource path="res://textures/rooot.png" type="Texture" id=1] +[ext_resource path="res://components/HackButton.gd" type="Script" id=2] + +[sub_resource type="RectangleShape2D" id=1] +extents = Vector2( 100, 100 ) + +[node name="HackButton" type="Area2D"] +monitoring = false +monitorable = false +script = ExtResource( 2 ) + +[node name="Sprite" type="Sprite" parent="."] +scale = Vector2( 0.5, 0.5 ) +texture = ExtResource( 1 ) + +[node name="CollisionShape2D" type="CollisionShape2D" parent="."] +shape = SubResource( 1 ) + +[connection signal="input_event" from="." to="." method="_on_HackButton_input_event"] +[connection signal="mouse_entered" from="." to="." method="_on_HackButton_mouse_entered"] +[connection signal="mouse_exited" from="." to="." method="_on_HackButton_mouse_exited"] diff --git a/hackingscene.gd b/hackingscene.gd new file mode 100644 index 0000000..641cc93 --- /dev/null +++ b/hackingscene.gd @@ -0,0 +1,9 @@ +extends Node2D + + +var button_presses = 0 + + +func _on_HackButton_on_click(): + button_presses += 1 + print(button_presses) diff --git a/hackingscene.tscn b/hackingscene.tscn index bf891b2..0b833c1 100644 --- a/hackingscene.tscn +++ b/hackingscene.tscn @@ -1,16 +1,19 @@ -[gd_scene load_steps=6 format=2] +[gd_scene load_steps=8 format=2] [ext_resource path="res://textures/background.png" type="Texture" id=1] [ext_resource path="res://textures/rooot.png" type="Texture" id=2] [ext_resource path="res://Camera2D.gd" type="Script" id=3] [ext_resource path="res://default_env.tres" type="Environment" id=4] +[ext_resource path="res://components/HackButton.tscn" type="PackedScene" id=5] +[ext_resource path="res://hackingscene.gd" type="Script" id=6] [sub_resource type="Curve2D" id=1] _data = { -"points": PoolVector2Array( 0, 0, 0, 0, 377.292, 120.601, 0, 0, 0, 0, 395.251, 374.278, 0, 0, 0, 0, 541.172, 385.502, 0, 0, 0, 0, 837.501, 345.094, 0, 0, 0, 0, 922.809, 55.4985, 0, 0, 0, 0, 538.927, -58.9926, 0, 0, 0, 0, 538.927, 163.255, 0, 0, 0, 0, 1266.28, 161.01, 0, 0, 0, 0, 1057.5, -296.955, 0, 0, 0, 0, 693.826, 64.4782, 0, 0, 0, 0, 833.012, -213.892 ) +"points": PoolVector2Array( 0, 0, 0, 0, -74.612, 128.932, 0, 0, 0, 0, 390.299, 185.629, 0, 0, 0, 0, 520.071, -115.492, 0, 0, 0, 0, 182.412, -341.018, 0, 0, 0, 0, -153.987, 20.5792, 0, 0, 0, 0, -131.308, 224.686 ) } [node name="Node2D" type="Node2D"] +script = ExtResource( 6 ) [node name="Camera2D" type="Camera2D" parent="."] current = true @@ -27,10 +30,14 @@ texture = ExtResource( 1 ) curve = SubResource( 1 ) [node name="rooot" type="Sprite" parent="."] -modulate = Color( 10.99, 1, 1, 1 ) -position = Vector2( 593.927, 265.399 ) +modulate = Color( 10.99, 26.74, 73.99, 1 ) +position = Vector2( -342.639, -166.374 ) scale = Vector2( 0.298461, 0.320911 ) texture = ExtResource( 2 ) [node name="WorldEnvironment" type="WorldEnvironment" parent="."] environment = ExtResource( 4 ) + +[node name="HackButton" parent="." instance=ExtResource( 5 )] + +[connection signal="on_click" from="HackButton" to="." method="_on_HackButton_on_click"] diff --git a/textures/blauuu.png b/textures/blauuu.png Binary files differnew file mode 100644 index 0000000..416d933 --- /dev/null +++ b/textures/blauuu.png diff --git a/textures/blauuu.png.import b/textures/blauuu.png.import new file mode 100644 index 0000000..da56a0d --- /dev/null +++ b/textures/blauuu.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/blauuu.png-22949d4eb9161508bb9aa3294d24b7e6.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://textures/blauuu.png" +dest_files=[ "res://.import/blauuu.png-22949d4eb9161508bb9aa3294d24b7e6.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 +stream=false +size_limit=0 +detect_3d=true +svg/scale=1.0 |