summaryrefslogtreecommitdiff
path: root/inventory_bar.gd
blob: 3f9bda364d2575ae7d10005279d57eb4f3255427 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
extends Control


var active_type: Block.Type = Block.Type.GRASS


func _input(event: InputEvent) -> void:
	if event.is_action_pressed("inventory_bar_slot_1"):
		_on_texture_rect_pressed()
	if event.is_action_pressed("inventory_bar_slot_2"):
		_on_texture_rect_2_pressed()
	if event.is_action_pressed("inventory_bar_slot_3"):
		_on_texture_rect_3_pressed()
	if event.is_action_pressed("inventory_bar_slot_4"):
		_on_texture_rect_4_pressed()
	if event.is_action_pressed("inventory_bar_slot_5"):
		_on_texture_rect_5_pressed()
	if event.is_action_pressed("inventory_bar_slot_6"):
		_on_texture_rect_6_pressed()


func _on_texture_rect_pressed() -> void:
	active_type = Block.Type.GRASS


func _on_texture_rect_2_pressed() -> void:
	active_type = Block.Type.STONE


func _on_texture_rect_3_pressed() -> void:
	active_type = Block.Type.ICE


func _on_texture_rect_4_pressed() -> void:
	active_type = Block.Type.WOOD


func _on_texture_rect_5_pressed() -> void:
	active_type = Block.Type.SAND


func _on_texture_rect_6_pressed() -> void:
	active_type = Block.Type.PLANKS