[WIP] More refactoring of RadialGame
Gameplay now functions correctly on differently sized instances of RadialGame.tscn Still needs to scale the menu to fit
This commit is contained in:
parent
fe27cdab0e
commit
6618938021
|
@ -102,10 +102,8 @@ __meta__ = {
|
|||
}
|
||||
|
||||
[node name="NoteHandler" type="Control" parent="Square"]
|
||||
anchor_left = 0.5
|
||||
anchor_top = 0.5
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 0.5
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
script = ExtResource( 8 )
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
|
@ -132,9 +130,14 @@ material = SubResource( 2 )
|
|||
[node name="notelines" type="MeshInstance2D" parent="Square/NoteHandler/Viewport/Center"]
|
||||
material = SubResource( 3 )
|
||||
|
||||
[node name="Painter" type="Node2D" parent="Square/NoteHandler"]
|
||||
[node name="Painter" type="Control" parent="Square"]
|
||||
material = SubResource( 4 )
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
script = ExtResource( 6 )
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="Menu" parent="Square" instance=ExtResource( 15 )]
|
||||
anchor_right = 1.0
|
||||
|
@ -159,5 +162,6 @@ __meta__ = {
|
|||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[connection signal="item_rect_changed" from="Square" to="Square/NoteHandler/Viewport" method="_on_Square_item_rect_changed"]
|
||||
[connection signal="column_pressed" from="Square/InputHandler" to="Square/NoteHandler" method="_on_InputHandler_column_pressed"]
|
||||
[connection signal="column_released" from="Square/InputHandler" to="Square/NoteHandler" method="_on_InputHandler_column_released"]
|
||||
|
|
|
@ -40,8 +40,9 @@ func _check_buttons(touch_positions):
|
|||
var global_center = rect_global_position + rect_size*0.5
|
||||
for pos in touch_positions:
|
||||
pos -= global_center
|
||||
pos /= rect_size.x * 0.5
|
||||
var pol = cartesian2polar(pos.x, pos.y)
|
||||
var dist = pol.x/GameTheme.receptor_ring_radius
|
||||
var dist = pol.x/GameTheme.receptor_ring_radius_normalized
|
||||
var angle = rad2deg(pol.y)
|
||||
if dist < TOUCHBUTTON_MIN_DIST: # Short circuit out to save some logic
|
||||
continue
|
||||
|
|
|
@ -7,7 +7,7 @@ export var ReceptorsPath := @'../Center/Receptors'
|
|||
onready var NoteHandler := get_node(NoteHandlerPath)
|
||||
onready var Receptors := get_node(ReceptorsPath)
|
||||
onready var ScoreText := $ScoreText
|
||||
onready var PVMusic := $PVMusic
|
||||
onready var PVMusic := SoundPlayer.music_player_pv
|
||||
|
||||
var genres = {}
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ var song_key = ''
|
|||
onready var MusicPlayer := SoundPlayer.music_player
|
||||
onready var VideoPlayer := Video.video
|
||||
|
||||
onready var Painter = $Painter
|
||||
onready var Painter = $'../Painter'
|
||||
onready var SlideTrailHandler = $'Viewport/Center/SlideTrailHandler'
|
||||
onready var JudgeText = $'Viewport/Center/JudgeText'
|
||||
onready var notelines = $'Viewport/Center/notelines'
|
||||
|
@ -399,10 +399,13 @@ func _input(event):
|
|||
else:
|
||||
return
|
||||
|
||||
pos /= rect_size*0.5 # Normalize to unit circle
|
||||
pos -= Vector2(1.0, 1.0) # Normalize to center
|
||||
pos *= GameTheme.receptor_ring_radius_normalized_inv # Normalize to receptor ring as slides are
|
||||
for i in range(len(active_slide_trails)-1, -1, -1): # Iterate backwards as we are potentially deleting entries
|
||||
var note = active_slide_trails[i]
|
||||
var center = note.get_position(note.progress) * GameTheme.receptor_ring_radius
|
||||
var center2 = note.get_position(min(note.progress+0.06, 1.0)) * GameTheme.receptor_ring_radius
|
||||
var center = note.get_position(note.progress)
|
||||
var center2 = note.get_position(min(note.progress+0.06, 1.0))
|
||||
if ((pos - center).length_squared() < Rules.SLIDE_RADIUS2) or ((pos - center2).length_squared() < Rules.SLIDE_RADIUS2):
|
||||
note.progress += 0.09
|
||||
if note.progress >= 1.0:
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
extends Node2D
|
||||
extends Control
|
||||
|
||||
onready var Viewport := get_node(@'../Viewport')
|
||||
onready var Viewport := get_node(@'../NoteHandler/Viewport')
|
||||
|
||||
func _draw():
|
||||
draw_texture_rect(Viewport.get_texture(), Rect2(-540, -540, 1080, 1080), false)
|
||||
draw_texture_rect(Viewport.get_texture(), Rect2(Vector2.ZERO, rect_size), false)
|
||||
# texture = Viewport.get_texture()
|
||||
|
|
|
@ -1,11 +1,12 @@
|
|||
extends Viewport
|
||||
|
||||
onready var base_height = ProjectSettings.get_setting('display/window/size/height')
|
||||
onready var base_height = 1080.0
|
||||
|
||||
var container_size := Vector2(1080, 1080)
|
||||
var scale := Vector2(1, 1)
|
||||
func set_render_scale(scale: Vector2):
|
||||
var ws = OS.window_size
|
||||
var dim = min(ws.x, ws.y)
|
||||
size = Vector2(dim, dim) * scale
|
||||
self.scale = scale
|
||||
size = container_size * scale
|
||||
$Center.position = size * 0.5
|
||||
$Center.scale = size/base_height
|
||||
|
||||
|
@ -13,3 +14,12 @@ func set_render_scale(scale: Vector2):
|
|||
func _ready():
|
||||
Settings.connect('subsampling_changed', self, 'set_render_scale')
|
||||
set_render_scale(Settings.subsampling)
|
||||
|
||||
|
||||
onready var Square := $'../../'
|
||||
onready var Root := $'/root'
|
||||
onready var Main := $'/root/main'
|
||||
func _on_Square_item_rect_changed() -> void:
|
||||
var winscale = Root.size.x/Main.rect_size.x
|
||||
container_size = Square.rect_size * winscale
|
||||
set_render_scale(scale)
|
||||
|
|
|
@ -111,6 +111,19 @@ func update_ring_mesh():
|
|||
temp_mesh.add_surface_from_arrays(Mesh.PRIMITIVE_TRIANGLE_STRIP, mesh_arrays)
|
||||
mesh = temp_mesh
|
||||
|
||||
func set_ring_vertex_count(num: int):
|
||||
assert(num > 3)
|
||||
ring_vertex_count = num
|
||||
update_ring_mesh()
|
||||
|
||||
func set_ring_skew(skew: int):
|
||||
ring_skew = skew
|
||||
update_ring_mesh()
|
||||
|
||||
func set_receptor_positions(skew:=0.0):
|
||||
material.set_shader_param("num_receptors", Rules.COLS)
|
||||
material.set_shader_param("receptor_offset", PI/Rules.COLS)
|
||||
|
||||
|
||||
func _draw():
|
||||
# draw_old(true, true)
|
||||
|
@ -131,20 +144,9 @@ func _draw():
|
|||
material.set_shader_param("shadow_color", shadow_color)
|
||||
material.set_shader_param("alpha", alpha)
|
||||
|
||||
draw_mesh(mesh, null, null, Transform2D(0.0, rect_size*0.5))
|
||||
|
||||
func set_ring_vertex_count(num: int):
|
||||
assert(num > 3)
|
||||
ring_vertex_count = num
|
||||
update_ring_mesh()
|
||||
|
||||
func set_ring_skew(skew: int):
|
||||
ring_skew = skew
|
||||
update_ring_mesh()
|
||||
|
||||
func set_receptor_positions(skew:=0.0):
|
||||
material.set_shader_param("num_receptors", Rules.COLS)
|
||||
material.set_shader_param("receptor_offset", PI/Rules.COLS)
|
||||
var scale = rect_size.x/1080.0
|
||||
draw_mesh(mesh, null, null, Transform2D(Vector2(scale,0), Vector2(0,scale), rect_size*0.5)) #rect_size*0.5))
|
||||
# draw_mesh(mesh, null, null, Transform2D(0.0, rect_size*0.5))
|
||||
|
||||
func _ready():
|
||||
add_child(tween)
|
||||
|
@ -154,7 +156,7 @@ func _ready():
|
|||
$"/root".connect("size_changed", self, "update")
|
||||
|
||||
func set_alpha(a):
|
||||
alpha = a
|
||||
alpha = 1.0 #a
|
||||
material.set_shader_param("alpha", alpha)
|
||||
|
||||
func fade(visible: bool):
|
||||
|
|
|
@ -43,6 +43,8 @@ var pitch_judgement := {
|
|||
}
|
||||
|
||||
var receptor_ring_radius := 460.0
|
||||
var receptor_ring_radius_normalized := 460.0/540.0
|
||||
var receptor_ring_radius_normalized_inv := 540.0/460.0
|
||||
var note_forecast_beats := 2.0 # Notes start to appear this many beats before you need to tap them
|
||||
const INNER_NOTE_CIRCLE_RATIO := 0.3 # Notes under this far from the center will zoom into existence
|
||||
const SLIDE_DELAY := 0.5 #0.125 #0.5 # Time in beats between the tap of the star and the start of the visual slide
|
||||
|
|
|
@ -22,7 +22,8 @@ const JUDGEMENT_SCORES = [1.0, 0.9, 0.75, 0.5, 0.0]
|
|||
const SCORE_STRINGS = ['SSS', 'SS', 'S', 'A⁺', 'A', 'B⁺', 'B', 'C⁺', 'C', 'F']
|
||||
const SCORE_CUTOFFS = [1.0, 0.975, 0.95, 0.9, 0.85, 0.8, 0.7, 0.6, 0.5]
|
||||
|
||||
const SLIDE_RADIUS2 = 10000.0 # Radius of 100px
|
||||
const SLIDE_RADIUS := 100.0/540.0 # Radius of 100px at 1080p, normalized
|
||||
const SLIDE_RADIUS2 = pow(SLIDE_RADIUS, 2)
|
||||
|
||||
# Not really a fan of Simply Love grading
|
||||
# Scoring can probably be fine with a strictly positive scheme, but I really dislike having so many grades and the ± feels meaningless.
|
||||
|
|
|
@ -39,6 +39,9 @@ func play(type: int, parent: Node, stream: AudioStream, volume_db: float = 0.0,
|
|||
|
||||
|
||||
var music_player := AudioStreamPlayer.new()
|
||||
var music_player_pv := AudioStreamPlayer.new()
|
||||
func _ready() -> void:
|
||||
add_child(music_player)
|
||||
music_player.bus = "Music"
|
||||
add_child(music_player_pv)
|
||||
music_player_pv.bus = "Preview"
|
||||
|
|
Loading…
Reference in New Issue