improve input handling
This commit is contained in:
parent
444a0ec1d5
commit
b9c2985632
5 changed files with 8 additions and 7 deletions
|
@ -1,9 +1,6 @@
|
||||||
extends Control
|
extends Control
|
||||||
|
|
||||||
|
var jump_key = "dialogic_next"
|
||||||
# Declare member variables here. Examples:
|
|
||||||
# var a = 2
|
|
||||||
# var b = "text"
|
|
||||||
|
|
||||||
var jumped = false
|
var jumped = false
|
||||||
|
|
||||||
|
@ -22,7 +19,7 @@ func _wait_for_jump():
|
||||||
hide()
|
hide()
|
||||||
|
|
||||||
func _input(event):
|
func _input(event):
|
||||||
if event.is_action_pressed("ui_accept"):
|
if event.is_action_pressed(jump_key):
|
||||||
jumped = true
|
jumped = true
|
||||||
|
|
||||||
# Called when the node enters the scene tree for the first time.
|
# Called when the node enters the scene tree for the first time.
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
[gd_scene load_steps=2 format=2]
|
[gd_scene load_steps=2 format=2]
|
||||||
|
|
||||||
[ext_resource path="res://scripts/player1.gd" type="Script" id=1]
|
[ext_resource path="res://mini-game/scripts/player1.gd" type="Script" id=1]
|
||||||
|
|
||||||
[node name="player1" type="Node2D"]
|
[node name="player1" type="Node2D"]
|
||||||
script = ExtResource( 1 )
|
script = ExtResource( 1 )
|
||||||
|
|
|
@ -19,6 +19,8 @@ enum {
|
||||||
TIME
|
TIME
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var jump_key = "dialogic_next"
|
||||||
|
|
||||||
var player_enabled = false
|
var player_enabled = false
|
||||||
var game_mode = "score"
|
var game_mode = "score"
|
||||||
|
|
||||||
|
@ -53,7 +55,7 @@ func _physics_process(delta):
|
||||||
|
|
||||||
|
|
||||||
func _input(event):
|
func _input(event):
|
||||||
if player_enabled and state == RUN and event.is_action_pressed("ui_accept"):
|
if player_enabled and state == RUN and event.is_action_pressed(jump_key):
|
||||||
state = JUMP
|
state = JUMP
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -52,6 +52,7 @@ margin_left = 1836.0
|
||||||
margin_right = 1900.0
|
margin_right = 1900.0
|
||||||
margin_bottom = 64.0
|
margin_bottom = 64.0
|
||||||
focus_mode = 0
|
focus_mode = 0
|
||||||
|
mouse_default_cursor_shape = 2
|
||||||
enabled_focus_mode = 0
|
enabled_focus_mode = 0
|
||||||
texture_normal = ExtResource( 1 )
|
texture_normal = ExtResource( 1 )
|
||||||
|
|
||||||
|
|
|
@ -56,6 +56,7 @@ margin_left = -1.33484
|
||||||
margin_top = -1.33484
|
margin_top = -1.33484
|
||||||
margin_right = 113.665
|
margin_right = 113.665
|
||||||
margin_bottom = 50.6652
|
margin_bottom = 50.6652
|
||||||
|
mouse_default_cursor_shape = 2
|
||||||
custom_styles/hover = SubResource( 1 )
|
custom_styles/hover = SubResource( 1 )
|
||||||
custom_styles/pressed = SubResource( 2 )
|
custom_styles/pressed = SubResource( 2 )
|
||||||
custom_styles/normal = SubResource( 3 )
|
custom_styles/normal = SubResource( 3 )
|
||||||
|
|
Loading…
Reference in a new issue