Browse Source

improve input handling

Arnaud Vergnet 5 months ago
parent
commit
b9c2985632

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

@@ -1,9 +1,6 @@
1 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 5
 var jumped = false
9 6
 
@@ -22,7 +19,7 @@ func _wait_for_jump():
22 19
 	hide()
23 20
 
24 21
 func _input(event):
25
-	if event.is_action_pressed("ui_accept"):
22
+	if event.is_action_pressed(jump_key):
26 23
 			jumped = true
27 24
 
28 25
 # Called when the node enters the scene tree for the first time.

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

@@ -1,6 +1,6 @@
1 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 5
 [node name="player1" type="Node2D"]
6 6
 script = ExtResource( 1 )

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

@@ -19,6 +19,8 @@ enum {
19 19
 	TIME
20 20
 }
21 21
 
22
+var jump_key = "dialogic_next"
23
+
22 24
 var player_enabled = false
23 25
 var game_mode = "score"
24 26
 
@@ -53,7 +55,7 @@ func _physics_process(delta):
53 55
 
54 56
 
55 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 59
 			state = JUMP
58 60
 
59 61
 

+ 1
- 0
scenes/UI.tscn View File

@@ -52,6 +52,7 @@ margin_left = 1836.0
52 52
 margin_right = 1900.0
53 53
 margin_bottom = 64.0
54 54
 focus_mode = 0
55
+mouse_default_cursor_shape = 2
55 56
 enabled_focus_mode = 0
56 57
 texture_normal = ExtResource( 1 )
57 58
 

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

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

Loading…
Cancel
Save