Skip to content

Commit 3afcd01

Browse files
button tweaks
1 parent d86b853 commit 3afcd01

File tree

3 files changed

+22
-20
lines changed

3 files changed

+22
-20
lines changed

Buttonthemes.tres

Lines changed: 14 additions & 14 deletions
Large diffs are not rendered by default.

main scene.tscn

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
[gd_scene load_steps=19 format=3 uid="uid://dlewy2ppts022"]
1+
[gd_scene load_steps=18 format=3 uid="uid://dlewy2ppts022"]
22

33
[ext_resource type="TileSet" uid="uid://bigbiha614tnl" path="res://tileset.tres" id="1_dur42"]
44
[ext_resource type="Script" path="res://main scene.gd" id="1_xhh2k"]
@@ -14,7 +14,6 @@
1414
[ext_resource type="Texture2D" uid="uid://dyxfr110a1xsu" path="res://uistuff/bitsui.png" id="9_oegee"]
1515
[ext_resource type="Texture2D" uid="uid://bcv16fbofoniw" path="res://uistuff/oilui.png" id="13_xw0jl"]
1616
[ext_resource type="Theme" uid="uid://b75f4m6ahlfqu" path="res://Buttonthemes.tres" id="15_07nre"]
17-
[ext_resource type="Script" path="res://powerui.gd" id="15_pnjia"]
1817

1918
[sub_resource type="Environment" id="Environment_xdtrx"]
2019
background_mode = 3
@@ -169,7 +168,6 @@ offset_right = 943.0
169168
offset_bottom = 411.0
170169
scale = Vector2(0.05, 0.05)
171170
theme_override_font_sizes/font_size = 400
172-
script = ExtResource("15_pnjia")
173171

174172
[node name="woodui" type="Label" parent="Camera2D"]
175173
offset_left = 186.0

place on tilemap.gd

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ var placingvalue = 0
44

55

66

7+
78
func _on_powerplantbutton_pressed():
89
var placingvalue = 1
910

@@ -18,9 +19,12 @@ func _on_recyclebutton_pressed():
1819

1920
func _input(event):
2021
# Mouse in viewport coordinates.
21-
if event is InputEventMouseButton and event.button_index == MOUSE_BUTTON_LEFT and event.is_pressed() == true:
22-
set_cell(0, Vector2i(floor(get_local_mouse_position()/32)), (placingvalue), Vector2i(0,0))
23-
print(ceil(get_local_mouse_position()/32))
22+
if placingvalue == 1:
23+
24+
if event is InputEventMouseButton and event.button_index == MOUSE_BUTTON_LEFT and event.is_pressed() == true:
25+
set_cell(0, Vector2i(floor(get_local_mouse_position()/32)), (1), Vector2i(0,0))
26+
print(ceil(get_local_mouse_position()/32))
27+
2428

2529

2630

0 commit comments

Comments
 (0)