Browse Source

improve input handling

Arnaud Vergnet 2 years ago
parent
commit
b9c2985632

+ 2
- 5
mini-game/scenes/decor/instructionsUI.gd View File

1
 extends Control
1
 extends Control
2
 
2
 
3
-
4
-# Declare member variables here. Examples:
5
-# var a = 2
6
-# var b = "text"
3
+var jump_key = "dialogic_next"
7
 
4
 
8
 var jumped = false
5
 var jumped = false
9
 
6
 
22
 	hide()
19
 	hide()
23
 
20
 
24
 func _input(event):
21
 func _input(event):
25
-	if event.is_action_pressed("ui_accept"):
22
+	if event.is_action_pressed(jump_key):
26
 			jumped = true
23
 			jumped = true
27
 
24
 
28
 # Called when the node enters the scene tree for the first time.
25
 # Called when the node enters the scene tree for the first time.

+ 1
- 1
mini-game/scenes/players/player1.tscn View File

1
 [gd_scene load_steps=2 format=2]
1
 [gd_scene load_steps=2 format=2]
2
 
2
 
3
-[ext_resource path="res://scripts/player1.gd" type="Script" id=1]
3
+[ext_resource path="res://mini-game/scripts/player1.gd" type="Script" id=1]
4
 
4
 
5
 [node name="player1" type="Node2D"]
5
 [node name="player1" type="Node2D"]
6
 script = ExtResource( 1 )
6
 script = ExtResource( 1 )

+ 3
- 1
mini-game/scripts/player2.gd View File

19
 	TIME
19
 	TIME
20
 }
20
 }
21
 
21
 
22
+var jump_key = "dialogic_next"
23
+
22
 var player_enabled = false
24
 var player_enabled = false
23
 var game_mode = "score"
25
 var game_mode = "score"
24
 
26
 
53
 
55
 
54
 
56
 
55
 func _input(event):
57
 func _input(event):
56
-	if player_enabled and state == RUN and event.is_action_pressed("ui_accept"):
58
+	if player_enabled and state == RUN and event.is_action_pressed(jump_key):
57
 			state = JUMP
59
 			state = JUMP
58
 
60
 
59
 
61
 

+ 1
- 0
scenes/UI.tscn View File

52
 margin_right = 1900.0
52
 margin_right = 1900.0
53
 margin_bottom = 64.0
53
 margin_bottom = 64.0
54
 focus_mode = 0
54
 focus_mode = 0
55
+mouse_default_cursor_shape = 2
55
 enabled_focus_mode = 0
56
 enabled_focus_mode = 0
56
 texture_normal = ExtResource( 1 )
57
 texture_normal = ExtResource( 1 )
57
 
58
 

+ 1
- 0
scenes/typo/Button.tscn View File

56
 margin_top = -1.33484
56
 margin_top = -1.33484
57
 margin_right = 113.665
57
 margin_right = 113.665
58
 margin_bottom = 50.6652
58
 margin_bottom = 50.6652
59
+mouse_default_cursor_shape = 2
59
 custom_styles/hover = SubResource( 1 )
60
 custom_styles/hover = SubResource( 1 )
60
 custom_styles/pressed = SubResource( 2 )
61
 custom_styles/pressed = SubResource( 2 )
61
 custom_styles/normal = SubResource( 3 )
62
 custom_styles/normal = SubResource( 3 )

Loading…
Cancel
Save