jog moving
This commit is contained in:
parent
e565b86c19
commit
bbd8ca9280
3 changed files with 97 additions and 50 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -1,5 +1,6 @@
|
||||||
# Godot 4+ specific ignores
|
# Godot 4+ specific ignores
|
||||||
.godot/
|
.godot/
|
||||||
|
addons/godot-git-plugin/win64/~libgit_plugin.windows.editor.x86_64.dll
|
||||||
|
|
||||||
*.tmp
|
*.tmp
|
||||||
exports
|
exports
|
||||||
|
|
|
||||||
24
node_2d.gd
24
node_2d.gd
|
|
@ -54,25 +54,33 @@ func _unhandled_input(input_event):
|
||||||
if input_event is InputEventMIDI:
|
if input_event is InputEventMIDI:
|
||||||
if debug > 0:
|
if debug > 0:
|
||||||
_print_midi_info(input_event)
|
_print_midi_info(input_event)
|
||||||
|
|
||||||
|
# animate a beat
|
||||||
if !midi_beat and input_event.channel == beat_channel and ((input_event.pitch == beat_note and input_event.velocity == 127) or input_event.controller_number == 10):
|
if !midi_beat and input_event.channel == beat_channel and ((input_event.pitch == beat_note and input_event.velocity == 127) or input_event.controller_number == 10):
|
||||||
if !midi_beat:
|
if !midi_beat:
|
||||||
$beat/AnimationPlayer.play("beat")
|
$beat/AnimationPlayer.play("beat")
|
||||||
midi_beat = true
|
midi_beat = true
|
||||||
if input_event.channel == beat_channel and ((input_event.pitch == beat_note and input_event.velocity == 0) or input_event.controller_number == 9):
|
elif input_event.channel == beat_channel and ((input_event.pitch == beat_note and input_event.velocity == 0) or input_event.controller_number == 9):
|
||||||
if midi_beat:
|
if midi_beat:
|
||||||
$beat/AnimationPlayer.play_backwards("beat")
|
$beat/AnimationPlayer.play("RESET")
|
||||||
midi_beat = false
|
midi_beat = false
|
||||||
|
|
||||||
|
# animate a grabbed jog
|
||||||
if input_event.channel == jog_channel and ((input_event.pitch == jog_note and input_event.velocity == 127) or input_event.controller_number == spin_note_1):
|
if input_event.channel == jog_channel and ((input_event.pitch == jog_note and input_event.velocity == 127) or input_event.controller_number == spin_note_1):
|
||||||
if !midi_jog:
|
if !midi_jog:
|
||||||
$jog/AnimationPlayer.play("jog")
|
$jog/AnimationPlayer.play("jog")
|
||||||
midi_jog = true
|
midi_jog = true
|
||||||
if input_event.channel == jog_channel and ((input_event.pitch == jog_note and input_event.velocity == 0) or input_event.controller_number == spin_note_2):
|
elif input_event.channel == jog_channel and ((input_event.pitch == jog_note and input_event.velocity == 0) or input_event.controller_number == spin_note_2):
|
||||||
if midi_jog:
|
if midi_jog:
|
||||||
$jog/AnimationPlayer.play_backwards("jog")
|
$jog/AnimationPlayer.play("RESET")
|
||||||
midi_jog = false
|
midi_jog = false
|
||||||
|
|
||||||
|
# animate a moving jog
|
||||||
if (input_event.channel == spin_channel_1 or input_event.channel == spin_channel_2) and input_event.controller_value == left:
|
if (input_event.channel == spin_channel_1 or input_event.channel == spin_channel_2) and input_event.controller_value == left:
|
||||||
|
$jog/AnimationPlayer.play("move")
|
||||||
midi_turnleft = true
|
midi_turnleft = true
|
||||||
if (input_event.channel == spin_channel_1 or input_event.channel == spin_channel_2) and input_event.controller_value == right:
|
elif (input_event.channel == spin_channel_1 or input_event.channel == spin_channel_2) and input_event.controller_value == right:
|
||||||
|
$jog/AnimationPlayer.play_backwards("move")
|
||||||
midi_turnright = true
|
midi_turnright = true
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -110,6 +118,12 @@ func _process(_delta):
|
||||||
# trigger the right controller
|
# trigger the right controller
|
||||||
print("turn right")
|
print("turn right")
|
||||||
|
|
||||||
|
|
||||||
|
if !midi_turnleft and !midi_turnright:
|
||||||
|
if !midi_jog:
|
||||||
|
$jog/AnimationPlayer.play("RESET")
|
||||||
|
|
||||||
|
|
||||||
# reset the turn values before the next cycle
|
# reset the turn values before the next cycle
|
||||||
# needed because it can't be turned to false in the _unhandled_input function
|
# needed because it can't be turned to false in the _unhandled_input function
|
||||||
# because apparently there is no MIDI command sended for that .___.
|
# because apparently there is no MIDI command sended for that .___.
|
||||||
|
|
|
||||||
122
node_2d.tscn
122
node_2d.tscn
|
|
@ -1,39 +1,12 @@
|
||||||
[gd_scene load_steps=11 format=3 uid="uid://chynesmvg3dl5"]
|
[gd_scene load_steps=13 format=3 uid="uid://chynesmvg3dl5"]
|
||||||
|
|
||||||
[ext_resource type="Texture2D" uid="uid://pa6jmogeid3x" path="res://art/turn.PNG" id="1_58q2i"]
|
[ext_resource type="Texture2D" uid="uid://pa6jmogeid3x" path="res://art/turn.PNG" id="1_58q2i"]
|
||||||
[ext_resource type="Script" path="res://node_2d.gd" id="1_r100h"]
|
[ext_resource type="Script" path="res://node_2d.gd" id="1_r100h"]
|
||||||
[ext_resource type="Texture2D" uid="uid://f8ibqo4nbqqk" path="res://art/bark.PNG" id="3_grsrk"]
|
[ext_resource type="Texture2D" uid="uid://f8ibqo4nbqqk" path="res://art/bark.PNG" id="3_grsrk"]
|
||||||
|
[ext_resource type="Script" path="res://jog.gd" id="4_m16or"]
|
||||||
|
|
||||||
[sub_resource type="GDScript" id="GDScript_grk35"]
|
[sub_resource type="GDScript" id="GDScript_grk35"]
|
||||||
|
|
||||||
[sub_resource type="Animation" id="Animation_e5aqk"]
|
|
||||||
resource_name = "jog"
|
|
||||||
length = 0.02
|
|
||||||
tracks/0/type = "value"
|
|
||||||
tracks/0/imported = false
|
|
||||||
tracks/0/enabled = true
|
|
||||||
tracks/0/path = NodePath(".:position")
|
|
||||||
tracks/0/interp = 1
|
|
||||||
tracks/0/loop_wrap = true
|
|
||||||
tracks/0/keys = {
|
|
||||||
"times": PackedFloat32Array(0),
|
|
||||||
"transitions": PackedFloat32Array(1),
|
|
||||||
"update": 0,
|
|
||||||
"values": [Vector2(1688, 342)]
|
|
||||||
}
|
|
||||||
tracks/1/type = "value"
|
|
||||||
tracks/1/imported = false
|
|
||||||
tracks/1/enabled = true
|
|
||||||
tracks/1/path = NodePath(".:rotation")
|
|
||||||
tracks/1/interp = 1
|
|
||||||
tracks/1/loop_wrap = true
|
|
||||||
tracks/1/keys = {
|
|
||||||
"times": PackedFloat32Array(0, 0.01),
|
|
||||||
"transitions": PackedFloat32Array(1, 1),
|
|
||||||
"update": 0,
|
|
||||||
"values": [4.43314, 4.11898]
|
|
||||||
}
|
|
||||||
|
|
||||||
[sub_resource type="Animation" id="Animation_720f4"]
|
[sub_resource type="Animation" id="Animation_720f4"]
|
||||||
length = 0.001
|
length = 0.001
|
||||||
tracks/0/type = "value"
|
tracks/0/type = "value"
|
||||||
|
|
@ -61,38 +34,68 @@ tracks/1/keys = {
|
||||||
"values": [4.43314]
|
"values": [4.43314]
|
||||||
}
|
}
|
||||||
|
|
||||||
[sub_resource type="AnimationLibrary" id="AnimationLibrary_pi6b0"]
|
[sub_resource type="Animation" id="Animation_e5aqk"]
|
||||||
_data = {
|
resource_name = "jog"
|
||||||
"RESET": SubResource("Animation_720f4"),
|
|
||||||
"jog": SubResource("Animation_e5aqk")
|
|
||||||
}
|
|
||||||
|
|
||||||
[sub_resource type="Animation" id="Animation_bdwea"]
|
|
||||||
resource_name = "beat"
|
|
||||||
length = 0.02
|
length = 0.02
|
||||||
tracks/0/type = "value"
|
tracks/0/type = "value"
|
||||||
tracks/0/imported = false
|
tracks/0/imported = false
|
||||||
tracks/0/enabled = true
|
tracks/0/enabled = true
|
||||||
tracks/0/path = NodePath("beat:position")
|
tracks/0/path = NodePath(".:position")
|
||||||
tracks/0/interp = 1
|
tracks/0/interp = 1
|
||||||
tracks/0/loop_wrap = true
|
tracks/0/loop_wrap = true
|
||||||
tracks/0/keys = {
|
tracks/0/keys = {
|
||||||
"times": PackedFloat32Array(0, 0.01),
|
"times": PackedFloat32Array(0),
|
||||||
"transitions": PackedFloat32Array(1, 1),
|
"transitions": PackedFloat32Array(1),
|
||||||
"update": 0,
|
"update": 0,
|
||||||
"values": [Vector2(137, 307), Vector2(158, 371)]
|
"values": [Vector2(1688, 342)]
|
||||||
}
|
}
|
||||||
tracks/1/type = "value"
|
tracks/1/type = "value"
|
||||||
tracks/1/imported = false
|
tracks/1/imported = false
|
||||||
tracks/1/enabled = true
|
tracks/1/enabled = true
|
||||||
tracks/1/path = NodePath("beat:rotation")
|
tracks/1/path = NodePath(".:rotation")
|
||||||
tracks/1/interp = 1
|
tracks/1/interp = 1
|
||||||
tracks/1/loop_wrap = true
|
tracks/1/loop_wrap = true
|
||||||
tracks/1/keys = {
|
tracks/1/keys = {
|
||||||
"times": PackedFloat32Array(0, 0.01),
|
"times": PackedFloat32Array(0),
|
||||||
"transitions": PackedFloat32Array(1, 1),
|
"transitions": PackedFloat32Array(1),
|
||||||
"update": 0,
|
"update": 0,
|
||||||
"values": [-1.29154, -0.959931]
|
"values": [4.11898]
|
||||||
|
}
|
||||||
|
|
||||||
|
[sub_resource type="Animation" id="Animation_no6c7"]
|
||||||
|
resource_name = "move"
|
||||||
|
length = 4.0
|
||||||
|
loop_mode = 1
|
||||||
|
tracks/0/type = "value"
|
||||||
|
tracks/0/imported = false
|
||||||
|
tracks/0/enabled = true
|
||||||
|
tracks/0/path = NodePath(".:position")
|
||||||
|
tracks/0/interp = 2
|
||||||
|
tracks/0/loop_wrap = true
|
||||||
|
tracks/0/keys = {
|
||||||
|
"times": PackedFloat32Array(0, 1, 2, 3),
|
||||||
|
"transitions": PackedFloat32Array(1, 1, 1, 1),
|
||||||
|
"update": 0,
|
||||||
|
"values": [Vector2(1688, 342), Vector2(1628, 406), Vector2(1739, 448), Vector2(1828, 389)]
|
||||||
|
}
|
||||||
|
tracks/1/type = "value"
|
||||||
|
tracks/1/imported = false
|
||||||
|
tracks/1/enabled = true
|
||||||
|
tracks/1/path = NodePath(".:rotation")
|
||||||
|
tracks/1/interp = 2
|
||||||
|
tracks/1/loop_wrap = true
|
||||||
|
tracks/1/keys = {
|
||||||
|
"times": PackedFloat32Array(0, 1, 2, 3),
|
||||||
|
"transitions": PackedFloat32Array(1, 1, 1, 1),
|
||||||
|
"update": 0,
|
||||||
|
"values": [4.11898, 3.92699, 4.15737, 4.36332]
|
||||||
|
}
|
||||||
|
|
||||||
|
[sub_resource type="AnimationLibrary" id="AnimationLibrary_pi6b0"]
|
||||||
|
_data = {
|
||||||
|
"RESET": SubResource("Animation_720f4"),
|
||||||
|
"jog": SubResource("Animation_e5aqk"),
|
||||||
|
"move": SubResource("Animation_no6c7")
|
||||||
}
|
}
|
||||||
|
|
||||||
[sub_resource type="Animation" id="Animation_khjd8"]
|
[sub_resource type="Animation" id="Animation_khjd8"]
|
||||||
|
|
@ -122,6 +125,34 @@ tracks/1/keys = {
|
||||||
"values": [-1.29154]
|
"values": [-1.29154]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[sub_resource type="Animation" id="Animation_bdwea"]
|
||||||
|
resource_name = "beat"
|
||||||
|
length = 0.02
|
||||||
|
tracks/0/type = "value"
|
||||||
|
tracks/0/imported = false
|
||||||
|
tracks/0/enabled = true
|
||||||
|
tracks/0/path = NodePath("beat:position")
|
||||||
|
tracks/0/interp = 1
|
||||||
|
tracks/0/loop_wrap = true
|
||||||
|
tracks/0/keys = {
|
||||||
|
"times": PackedFloat32Array(0),
|
||||||
|
"transitions": PackedFloat32Array(1),
|
||||||
|
"update": 0,
|
||||||
|
"values": [Vector2(158, 371)]
|
||||||
|
}
|
||||||
|
tracks/1/type = "value"
|
||||||
|
tracks/1/imported = false
|
||||||
|
tracks/1/enabled = true
|
||||||
|
tracks/1/path = NodePath("beat:rotation")
|
||||||
|
tracks/1/interp = 1
|
||||||
|
tracks/1/loop_wrap = true
|
||||||
|
tracks/1/keys = {
|
||||||
|
"times": PackedFloat32Array(0),
|
||||||
|
"transitions": PackedFloat32Array(1),
|
||||||
|
"update": 0,
|
||||||
|
"values": [-0.959931]
|
||||||
|
}
|
||||||
|
|
||||||
[sub_resource type="AnimationLibrary" id="AnimationLibrary_jc7n3"]
|
[sub_resource type="AnimationLibrary" id="AnimationLibrary_jc7n3"]
|
||||||
_data = {
|
_data = {
|
||||||
"RESET": SubResource("Animation_khjd8"),
|
"RESET": SubResource("Animation_khjd8"),
|
||||||
|
|
@ -148,6 +179,7 @@ rotation = 4.43314
|
||||||
scale = Vector2(0.5, 0.5)
|
scale = Vector2(0.5, 0.5)
|
||||||
texture = ExtResource("3_grsrk")
|
texture = ExtResource("3_grsrk")
|
||||||
flip_v = true
|
flip_v = true
|
||||||
|
script = ExtResource("4_m16or")
|
||||||
|
|
||||||
[node name="AnimationPlayer" type="AnimationPlayer" parent="jog"]
|
[node name="AnimationPlayer" type="AnimationPlayer" parent="jog"]
|
||||||
libraries = {
|
libraries = {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue