ddr gaming

This commit is contained in:
Tabby 2025-05-13 15:56:51 +10:00
parent 04417dffbd
commit 288245037b
25 changed files with 466 additions and 6 deletions

View file

@ -3,18 +3,18 @@
[ext_resource type="Script" uid="uid://brih2jftm2tsa" path="res://games/asteroids/ship_controller.gd" id="1_6dc0m"]
[ext_resource type="Texture2D" uid="uid://dqorec3q3h3pp" path="res://sprites/asteroidsShip.png" id="2_j0tb1"]
[sub_resource type="Gradient" id="Gradient_4laqq"]
[sub_resource type="Gradient" id="Gradient_6dc0m"]
interpolation_mode = 1
offsets = PackedFloat32Array(0, 0.882845)
[sub_resource type="FastNoiseLite" id="FastNoiseLite_ceqm6"]
[sub_resource type="FastNoiseLite" id="FastNoiseLite_j0tb1"]
frequency = 0.0683
[sub_resource type="NoiseTexture2D" id="NoiseTexture2D_f07rl"]
width = 640
height = 360
color_ramp = SubResource("Gradient_4laqq")
noise = SubResource("FastNoiseLite_ceqm6")
color_ramp = SubResource("Gradient_6dc0m")
noise = SubResource("FastNoiseLite_j0tb1")
[sub_resource type="CircleShape2D" id="CircleShape2D_dtqgl"]
radius = 26.0192

33
games/ddr/ddr.gd Normal file
View file

@ -0,0 +1,33 @@
extends Node
@export var note_frequency : float = 2
@export var paths : Array[Node2D]
var next_note : float = 99
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
next_note = note_frequency
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta: float) -> void:
next_note -= delta
if(next_note <= 0):
next_note = note_frequency
spawn_note()
if(Input.is_action_just_pressed("ddr_left")):
detect_hit(0)
if(Input.is_action_just_pressed("ddr_down")):
detect_hit(1)
if(Input.is_action_just_pressed("ddr_up")):
detect_hit(2)
if(Input.is_action_just_pressed("ddr_right")):
detect_hit(3)
func spawn_note():
var ran_path = randi_range(0, paths.size()-1)
paths[ran_path].spawn_note()
func detect_hit(lane : int):
paths[lane].check_hit()

1
games/ddr/ddr.gd.uid Normal file
View file

@ -0,0 +1 @@
uid://dv72o4x8p6raq

48
games/ddr/ddr.tscn Normal file
View file

@ -0,0 +1,48 @@
[gd_scene load_steps=8 format=3 uid="uid://b5lh8cnwu8xhg"]
[ext_resource type="PackedScene" uid="uid://dgg4fsg4xhdwa" path="res://games/ddr/note_path.tscn" id="1_wdky4"]
[ext_resource type="Script" uid="uid://dv72o4x8p6raq" path="res://games/ddr/ddr.gd" id="1_wvoco"]
[ext_resource type="Texture2D" uid="uid://50vdogpsfifh" path="res://sprites/ddr_green.png" id="2_oxbdn"]
[ext_resource type="Texture2D" uid="uid://c30il7iehgccl" path="res://sprites/ddr_yellow.png" id="3_wvoco"]
[ext_resource type="Texture2D" uid="uid://c3rmkv7q4q8gc" path="res://sprites/ddr_blue.png" id="4_i3ush"]
[sub_resource type="Gradient" id="Gradient_s8ryg"]
interpolation_color_space = 2
offsets = PackedFloat32Array(0, 0.129707, 1)
colors = PackedColorArray(5.17406e-07, 0.310176, 0.264961, 1, 0, 0.313239, 0.313239, 1, 0.313805, 0.000234589, 0.377941, 1)
[sub_resource type="GradientTexture2D" id="GradientTexture2D_wdky4"]
gradient = SubResource("Gradient_s8ryg")
fill = 2
fill_from = Vector2(0.542735, 1)
fill_to = Vector2(0.487179, 0)
[node name="Ddr" type="Node" node_paths=PackedStringArray("paths")]
script = ExtResource("1_wvoco")
paths = [NodePath("left_path"), NodePath("down_path"), NodePath("up_path"), NodePath("right_path")]
[node name="TextureRect" type="TextureRect" parent="."]
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
texture = SubResource("GradientTexture2D_wdky4")
[node name="left_path" parent="." instance=ExtResource("1_wdky4")]
position = Vector2(379, 40)
arrow_rotation = 270
[node name="down_path" parent="." instance=ExtResource("1_wdky4")]
position = Vector2(445, 40)
arrow_texture = ExtResource("2_oxbdn")
arrow_rotation = 180
[node name="up_path" parent="." instance=ExtResource("1_wdky4")]
position = Vector2(511, 40)
arrow_texture = ExtResource("3_wvoco")
[node name="right_path" parent="." instance=ExtResource("1_wdky4")]
position = Vector2(577, 40)
arrow_texture = ExtResource("4_i3ush")
arrow_rotation = 90

14
games/ddr/ddr_note.gd Normal file
View file

@ -0,0 +1,14 @@
extends Node2D
var note_speed : float = 1
@export_group("Node References")
@export var sprite : Sprite2D
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
pass # Replace with function body.
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta: float) -> void:
position.y -= note_speed * delta

View file

@ -0,0 +1 @@
uid://c1bu18t3p2nuq

20
games/ddr/ddr_note.tscn Normal file
View file

@ -0,0 +1,20 @@
[gd_scene load_steps=4 format=3 uid="uid://br48sxf5llkep"]
[ext_resource type="Texture2D" uid="uid://co01e75fr42v2" path="res://sprites/ddr_red.png" id="1_eadbn"]
[ext_resource type="Script" uid="uid://c1bu18t3p2nuq" path="res://games/ddr/ddr_note.gd" id="1_olog6"]
[sub_resource type="RectangleShape2D" id="RectangleShape2D_olog6"]
size = Vector2(30, 30)
[node name="DdrNote" type="Node2D" node_paths=PackedStringArray("sprite")]
scale = Vector2(2, 2)
script = ExtResource("1_olog6")
sprite = NodePath("Sprite2D")
[node name="Area2D" type="Area2D" parent="."]
[node name="CollisionShape2D" type="CollisionShape2D" parent="Area2D"]
shape = SubResource("RectangleShape2D_olog6")
[node name="Sprite2D" type="Sprite2D" parent="."]
texture = ExtResource("1_eadbn")

48
games/ddr/note_path.gd Normal file
View file

@ -0,0 +1,48 @@
extends Node2D
signal note_hit
signal note_miss
@export var note_speed : float = 1
#@export var frequency_min : float = 0.5
#@export var frequency_max : float = 2
@export var arrow_texture : Texture
@export var arrow_rotation : int =0
@export_group("Node References")
@export var detection_area : Area2D
@export var judgement_arrow : Sprite2D
@export var note_spawn_location : Marker2D
#var next_spawn_time : float = 10
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
judgement_arrow.rotation_degrees += arrow_rotation
#next_spawn_time = randf_range(frequency_min, frequency_max)
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta: float) -> void:
#next_spawn_time -= delta
#if next_spawn_time <= 0:
#next_spawn_time = randf_range(frequency_min, frequency_max)
#spawn_note()
pass
func spawn_note():
var new_note : Node2D = load("res://games/ddr/ddr_note.tscn").instantiate()
new_note.sprite.texture = arrow_texture
new_note.note_speed = note_speed
new_note.global_position = note_spawn_location.global_position
new_note.rotation_degrees += arrow_rotation
get_parent().add_child(new_note)
func _on_kill_area_entered(area: Area2D) -> void:
note_miss.emit()
func check_hit():
if (detection_area.get_overlapping_areas().size() > 0):
note_hit.emit()
detection_area.get_overlapping_areas()[0].get_parent().queue_free()

View file

@ -0,0 +1 @@
uid://ctxqhit4up2a1

45
games/ddr/note_path.tscn Normal file
View file

@ -0,0 +1,45 @@
[gd_scene load_steps=6 format=3 uid="uid://dgg4fsg4xhdwa"]
[ext_resource type="Script" uid="uid://ctxqhit4up2a1" path="res://games/ddr/note_path.gd" id="1_ddair"]
[ext_resource type="Texture2D" uid="uid://co01e75fr42v2" path="res://sprites/ddr_red.png" id="2_1p2y5"]
[ext_resource type="Texture2D" uid="uid://5fc77pbmdrlx" path="res://sprites/ddr_grey.png" id="3_6whpv"]
[sub_resource type="RectangleShape2D" id="RectangleShape2D_oxbdn"]
size = Vector2(60, 12)
[sub_resource type="RectangleShape2D" id="RectangleShape2D_ddair"]
size = Vector2(60, 12)
[node name="NotePath" type="Node2D" node_paths=PackedStringArray("detection_area", "judgement_arrow", "note_spawn_location")]
script = ExtResource("1_ddair")
note_speed = 75.0
arrow_texture = ExtResource("2_1p2y5")
detection_area = NodePath("Hit/Area2D")
judgement_arrow = NodePath("Hit/Sprite2D")
note_spawn_location = NodePath("NoteSpawn")
[node name="NoteSpawn" type="Marker2D" parent="."]
position = Vector2(0, 366)
[node name="Hit" type="Node2D" parent="."]
[node name="Sprite2D" type="Sprite2D" parent="Hit"]
modulate = Color(1, 1, 1, 0.32549)
scale = Vector2(2, 2)
texture = ExtResource("3_6whpv")
[node name="Area2D" type="Area2D" parent="Hit"]
[node name="CollisionShape2D" type="CollisionShape2D" parent="Hit/Area2D"]
shape = SubResource("RectangleShape2D_oxbdn")
[node name="NoteKiller" type="Node2D" parent="."]
[node name="Area2D" type="Area2D" parent="NoteKiller"]
[node name="CollisionShape2D" type="CollisionShape2D" parent="NoteKiller/Area2D"]
position = Vector2(0, -96)
shape = SubResource("RectangleShape2D_ddair")
debug_color = Color(0.993681, 0.0732683, 0, 0.42)
[connection signal="area_entered" from="NoteKiller/Area2D" to="." method="_on_kill_area_entered"]

View file

@ -0,0 +1,37 @@
extends CharacterBody2D
const SPEED = 300.0
const JUMP_VELOCITY = -400.0
@export var time_per_bullet : float = 2
var next_bullet : float =2
@export var bullet_spawn : Marker2D
@export var bullet_goal : Marker2D
func _ready() -> void:
next_bullet = time_per_bullet
func _process(delta: float) -> void:
next_bullet -= delta
if next_bullet <= 0:
shoot()
func shoot():
next_bullet = time_per_bullet
var new_bullet : Node2D = load("res://games/asteroids/bullet.tscn").instantiate() as Node2D
new_bullet.goal = bullet_goal.global_position
new_bullet.position = bullet_spawn.global_position
get_parent().add_child(new_bullet)
func _physics_process(delta: float) -> void:
# Get the input direction and handle the movement/deceleration.
# As good practice, you should replace UI actions with custom gameplay actions.
var direction := Input.get_axis("invaders_left", "invaders_right")
if direction:
velocity.x = direction * SPEED
else:
velocity.x = move_toward(velocity.x, 0, SPEED)
move_and_slide()

View file

@ -0,0 +1 @@
uid://c1e46eu5tbni0

View file

@ -1,6 +1,7 @@
[gd_scene load_steps=8 format=3 uid="uid://bkabgl6p44c5b"]
[gd_scene load_steps=9 format=3 uid="uid://bkabgl6p44c5b"]
[ext_resource type="Texture2D" uid="uid://dqorec3q3h3pp" path="res://sprites/asteroidsShip.png" id="1_8m3yy"]
[ext_resource type="Script" uid="uid://c1e46eu5tbni0" path="res://games/space invaders/ship.gd" id="1_jsxp6"]
[ext_resource type="Texture2D" uid="uid://by327tfhk6xrs" path="res://sprites/invadersBarrier.png" id="2_jsxp6"]
[sub_resource type="Gradient" id="Gradient_4laqq"]
@ -32,9 +33,13 @@ grow_horizontal = 2
grow_vertical = 2
texture = SubResource("NoiseTexture2D_k5cbn")
[node name="Ship" type="CharacterBody2D" parent="."]
[node name="Ship" type="CharacterBody2D" parent="." node_paths=PackedStringArray("bullet_spawn", "bullet_goal")]
position = Vector2(336, 319)
rotation = -1.5708
motion_mode = 1
script = ExtResource("1_jsxp6")
bullet_spawn = NodePath("Spawn")
bullet_goal = NodePath("Goal")
[node name="Sprite2D" type="Sprite2D" parent="Ship"]
texture = ExtResource("1_8m3yy")
@ -42,6 +47,12 @@ texture = ExtResource("1_8m3yy")
[node name="CollisionShape2D" type="CollisionShape2D" parent="Ship"]
shape = SubResource("CircleShape2D_jdxs5")
[node name="Spawn" type="Marker2D" parent="Ship"]
position = Vector2(34, 1.48619e-06)
[node name="Goal" type="Marker2D" parent="Ship"]
position = Vector2(335, 1.46433e-05)
[node name="Barrier" type="StaticBody2D" parent="."]
position = Vector2(334, 264)

View file

@ -178,6 +178,36 @@ crafting_m={
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":77,"key_label":0,"unicode":109,"location":0,"echo":false,"script":null)
]
}
invaders_left={
"deadzone": 0.2,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":79,"key_label":0,"unicode":111,"location":0,"echo":false,"script":null)
]
}
invaders_right={
"deadzone": 0.2,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":80,"key_label":0,"unicode":112,"location":0,"echo":false,"script":null)
]
}
ddr_up={
"deadzone": 0.2,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194320,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
]
}
ddr_down={
"deadzone": 0.2,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194322,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
]
}
ddr_left={
"deadzone": 0.2,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194319,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
]
}
ddr_right={
"deadzone": 0.2,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194321,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
]
}
[rendering]

BIN
sprites/ddr.pdn Normal file

Binary file not shown.

BIN
sprites/ddr_blue.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 537 B

View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://c3rmkv7q4q8gc"
path="res://.godot/imported/ddr_blue.png-b17b39e41cf7b362d9bb9ed464784f1d.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://sprites/ddr_blue.png"
dest_files=["res://.godot/imported/ddr_blue.png-b17b39e41cf7b362d9bb9ed464784f1d.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

BIN
sprites/ddr_green.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 537 B

View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://50vdogpsfifh"
path="res://.godot/imported/ddr_green.png-3d7bdb8e72405a9be2ca33e39d40a60e.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://sprites/ddr_green.png"
dest_files=["res://.godot/imported/ddr_green.png-3d7bdb8e72405a9be2ca33e39d40a60e.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

BIN
sprites/ddr_grey.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 537 B

View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://5fc77pbmdrlx"
path="res://.godot/imported/ddr_grey.png-a6764783dbccdc5afd408cf0902b6411.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://sprites/ddr_grey.png"
dest_files=["res://.godot/imported/ddr_grey.png-a6764783dbccdc5afd408cf0902b6411.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

BIN
sprites/ddr_red.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 537 B

View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://co01e75fr42v2"
path="res://.godot/imported/ddr_red.png-fb3346054bfea04dbf151c2b538bba4c.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://sprites/ddr_red.png"
dest_files=["res://.godot/imported/ddr_red.png-fb3346054bfea04dbf151c2b538bba4c.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

BIN
sprites/ddr_yellow.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 537 B

View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://c30il7iehgccl"
path="res://.godot/imported/ddr_yellow.png-012cade876880f5b9523f0b7175ebdee.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://sprites/ddr_yellow.png"
dest_files=["res://.godot/imported/ddr_yellow.png-012cade876880f5b9523f0b7175ebdee.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1