Merge hold arrows and note sprites onto a single spritesheet

This commit is contained in:
Luke Hubmayer-Werner 2020-12-21 22:52:15 +10:30
parent 5b44ad125c
commit ed114f2101
13 changed files with 328 additions and 129 deletions

35
Menu.tscn Normal file
View File

@ -0,0 +1,35 @@
[gd_scene load_steps=4 format=2]
[ext_resource path="res://scripts/Menu.gd" type="Script" id=1]
[ext_resource path="res://scripts/ScoreText.gd" type="Script" id=2]
[ext_resource path="res://shaders/scoretext.tres" type="Material" id=3]
[node name="Menu" type="Control"]
margin_left = -540.0
margin_top = -540.0
margin_right = 540.0
margin_bottom = 540.0
rect_pivot_offset = Vector2( 540, 540 )
rect_clip_content = true
script = ExtResource( 1 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="SongSelector" type="Control" parent="."]
margin_right = 40.0
margin_bottom = 40.0
__meta__ = {
"_edit_use_anchors_": false
}
[node name="ChartSelector" type="Control" parent="."]
margin_right = 40.0
margin_bottom = 40.0
__meta__ = {
"_edit_use_anchors_": false
}
[node name="ScoreText" type="Node2D" parent="."]
material = ExtResource( 3 )
script = ExtResource( 2 )

64
NoteHandler.tscn Normal file
View File

@ -0,0 +1,64 @@
[gd_scene load_steps=10 format=2]
[ext_resource path="res://scripts/NoteViewport.gd" type="Script" id=1]
[ext_resource path="res://shaders/notemesh.shader" type="Shader" id=2]
[ext_resource path="res://scripts/NoteHandler.gd" type="Script" id=3]
[ext_resource path="res://shaders/notelines.shader" type="Shader" id=4]
[ext_resource path="res://assets/text-4k.png" type="Texture" id=5]
[ext_resource path="res://scripts/NotePainter.gd" type="Script" id=6]
[sub_resource type="ShaderMaterial" id=3]
shader = ExtResource( 2 )
shader_param/bps = null
shader_param/star_color = null
shader_param/held_color = null
shader_param/screen_size = null
[sub_resource type="ShaderMaterial" id=4]
shader = ExtResource( 4 )
shader_param/line_color = Color( 0.8, 0.8, 1, 0.8 )
shader_param/line_color_double = Color( 1, 1, 0.6, 0.9 )
shader_param/dot_color = Color( 1, 1, 1, 0.8 )
shader_param/bps = 1.0
shader_param/line_thickness = 0.012
shader_param/line_thickness_min = 0.0
shader_param/dot_thickness = 0.033
shader_param/dot_fullbright_thickness = 0.013
shader_param/max_angle = 1.0708
shader_param/max_dist = 1.25
shader_param/array_postmul = Vector3( 1, 1, 1 )
shader_param/cols_div2 = 3.999
shader_param/array_sidelen = 16
shader_param/array_size = 256
[sub_resource type="CanvasItemMaterial" id=5]
blend_mode = 4
[node name="NoteHandler" type="Node2D"]
script = ExtResource( 3 )
[node name="Viewport" type="Viewport" parent="."]
size = Vector2( 540, 540 )
transparent_bg = true
usage = 1
render_target_v_flip = true
script = ExtResource( 1 )
[node name="Center" type="Node2D" parent="Viewport"]
position = Vector2( 270, 270 )
scale = Vector2( 0.5, 0.5 )
[node name="SlideTrailHandler" type="Node2D" parent="Viewport/Center"]
[node name="JudgeText" type="MeshInstance2D" parent="Viewport/Center"]
texture = ExtResource( 5 )
[node name="meshinstance" type="MeshInstance2D" parent="Viewport/Center"]
material = SubResource( 3 )
[node name="notelines" type="MeshInstance2D" parent="Viewport/Center"]
material = SubResource( 4 )
[node name="Painter" type="Node2D" parent="."]
material = SubResource( 5 )
script = ExtResource( 6 )

BIN
assets/spritesheet-1024.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 79 KiB

View File

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/spritesheet-1024.png-b98defd5d8caae46c768f7bc615ffa47.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/spritesheet-1024.png"
dest_files=[ "res://.import/spritesheet-1024.png-b98defd5d8caae46c768f7bc615ffa47.stex" ]
[params]
compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=true
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0

BIN
assets/spritesheet-2048.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 197 KiB

View File

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/spritesheet-2048.png-6d095a381aa1366de927fa579d371269.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/spritesheet-2048.png"
dest_files=[ "res://.import/spritesheet-2048.png-6d095a381aa1366de927fa579d371269.stex" ]
[params]
compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=true
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0

View File

@ -15,7 +15,7 @@
id="svg8"
inkscape:version="1.0.1 (3bc2e813f5, 2020-09-07)"
sodipodi:docname="spritesheet.svg"
inkscape:export-filename="/home/luke/godot/rhythm/spritesheet-512.png"
inkscape:export-filename="/home/luke/godot/rhythm/assets/spritesheet-1024.png"
inkscape:export-xdpi="96"
inkscape:export-ydpi="96">
<defs
@ -27,9 +27,9 @@
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="1.4142136"
inkscape:cx="237.69457"
inkscape:cy="476.53435"
inkscape:zoom="0.70710678"
inkscape:cx="465.37094"
inkscape:cy="257.5019"
inkscape:document-units="px"
inkscape:current-layer="layerFill"
showgrid="true"
@ -161,6 +161,19 @@
y="256"
xlink:href="#thickArrowO"
id="thickArrowReceptorO" />
<use
xlink:href="#holdBackground"
id="holdBGfill"
style="fill:#0000ff" />
<path
id="holdBackground"
d="m 288,368 96,-80 96,80 v 32 l -96,80 -96,-80 z"
sodipodi:nodetypes="ccccccc" />
<use
x="256"
xlink:href="#holdBackground"
id="rollBackground"
style="fill:#00ff00" />
</g>
<g
inkscape:groupmode="layer"
@ -187,6 +200,13 @@
id="thickArrowReceptorO2"
y="256"
style="stroke-width:38" />
<use
xlink:href="#holdBackground"
id="holdBackgroundO2" />
<use
xlink:href="#holdBackground"
id="rollBackgroundO2"
x="256" />
</g>
<g
inkscape:groupmode="layer"
@ -218,5 +238,12 @@
id="thickArrowReceptorF"
y="256"
style="stroke-width:18;fill:#ff0000" />
<use
xlink:href="#holdBackground"
id="holdBackgroundF" />
<use
xlink:href="#holdBackground"
id="rollBackgroundF"
x="256" />
</g>
</svg>

Before

Width:  |  Height:  |  Size: 7.2 KiB

After

Width:  |  Height:  |  Size: 7.9 KiB

View File

@ -64,7 +64,6 @@ shader_param/dot_fullbright_thickness = 0.013
shader_param/max_angle = 1.0708
shader_param/max_dist = 1.25
shader_param/array_postmul = Vector3( 1, 1, 1 )
shader_param/cols_div2 = 3.999
shader_param/array_sidelen = 16
shader_param/array_size = 256

View File

@ -8,11 +8,6 @@
config_version=4
_global_script_classes=[ ]
_global_script_class_icons={
}
[application]
config/name="Rhythm"
@ -62,7 +57,6 @@ singletons_disabled=[ ]
[rendering]
quality/driver/driver_name="GLES2"
vram_compression/import_etc=true
environment/default_clear_color=Color( 0.16, 0.16, 0.16, 1 )
quality/filters/msaa=1

View File

@ -14,13 +14,22 @@ const ERROR_CODES := [
]
var userroot := OS.get_user_data_dir().rstrip('/')+'/' if OS.get_name() != 'Android' else '/storage/emulated/0/RhythmGame/'
var PATHS := [userroot, '/media/fridge-q/Games/Other/maimai Finale/decoded/RhythmGameCharts/slow_userdir/'] # Temporary hardcoded testing
var PATHS := PoolStringArray([userroot, '/media/fridge-q/Games/Other/maimai Finale/decoded/RhythmGameCharts/slow_userdir/']) # Temporary hardcoded testing
# The following would probably work. One huge caveat is that permission needs to be manually granted by the user in app settings as we can't use OS.request_permission('WRITE_EXTERNAL_STORAGE')
# '/storage/emulated/0/Android/data/au.ufeff.rhythmgame/'
# '/sdcard/Android/data/au.ufeff.rhythmgame/'
func _ready() -> void:
print('Library paths: ', PATHS)
func find_file(name: String) -> String:
# Searches through all of the paths to find the file
var file := File.new()
for root in PATHS:
var filename: String = root + name
if file.file_exists(filename):
return filename
return ''
func directory_list(directory: String, hidden: bool, sort:=true) -> Dictionary:
# Sadly there's no filelist sugar so we make our own
var output = {folders=[], files=[], err=OK}
@ -567,36 +576,32 @@ func load_folder(folder, filename='song'):
func load_filelist(filelist: Array, directory=''):
var charts = {}
var key := 1
for filename in filelist:
var extension: String = filename.rsplit('.', true, 1)[-1]
filename = directory.rstrip('/') + '/' + filename
var file = File.new()
for root in PATHS:
var filename1 = root + filename
if file.file_exists(filename1):
filename = filename1
break
match extension:
'rgtm': # multiple charts
var res = RGT.load_file(filename)
for k in res:
charts[k] = res[k]
'rgts', 'rgtx': # single chart
charts[key] = RGT.load_file(filename)
key += 1
'srt': # maimai, single chart
charts[key] = SRT.load_file(filename)
key += 1
'sm': # Stepmania, multiple charts
var res = SM.load_file(filename)
for k in res:
charts[k] = res[k]
_:
pass
for name in filelist:
var extension: String = name.rsplit('.', true, 1)[-1]
name = directory.rstrip('/') + '/' + name
var filename = find_file(name)
if filename != '':
match extension:
'rgtm': # multiple charts
var res = RGT.load_file(filename)
for k in res:
charts[k] = res[k]
'rgts', 'rgtx': # single chart
charts[key] = RGT.load_file(filename)
key += 1
'srt': # maimai, single chart
charts[key] = SRT.load_file(filename)
key += 1
'sm': # Stepmania, multiple charts
var res = SM.load_file(filename)
for k in res:
charts[k] = res[k]
_:
pass
return charts
func direct_load_ogg(filename) -> AudioStreamOGGVorbis:
func direct_load_ogg(filename: String) -> AudioStreamOGGVorbis:
# Loads the ogg file with that exact filename
var audiostream = AudioStreamOGGVorbis.new()
var oggfile = File.new()
oggfile.open(filename, File.READ)
@ -605,27 +610,23 @@ func direct_load_ogg(filename) -> AudioStreamOGGVorbis:
return audiostream
var fallback_audiostream = AudioStreamOGGVorbis.new()
func load_ogg(filename) -> AudioStreamOGGVorbis:
var file = File.new()
for root in PATHS:
var filename1 = root + filename
if file.file_exists(filename1):
return direct_load_ogg(filename1)
return fallback_audiostream
func load_ogg(name: String) -> AudioStreamOGGVorbis:
# Searches through all of the paths to find the file
match find_file(name):
'': return fallback_audiostream
var filename: return direct_load_ogg(filename)
var fallback_videostream = VideoStreamWebm.new()
func load_video(filename):
var file = File.new()
for root in PATHS:
var filename1 = root + filename
if file.file_exists(filename1):
return load(filename1)
# var videostream = VideoStreamGDNative.new()
# videostream.set_file(filename1)
# return videostream
return fallback_videostream
func load_video(name: String):
match find_file(name):
'': return fallback_videostream
var filename:
return load(filename)
# var videostream = VideoStreamGDNative.new()
# videostream.set_file(filename1)
# return videostream
func direct_load_image(filename) -> ImageTexture:
func direct_load_image(filename: String) -> ImageTexture:
var tex := ImageTexture.new()
var img := Image.new()
img.load(filename)
@ -633,13 +634,11 @@ func direct_load_image(filename) -> ImageTexture:
return tex
var fallback_texture := ImageTexture.new()
func load_image(filename) -> ImageTexture:
var file = File.new()
for root in PATHS:
var filename1 = root + filename
if file.file_exists(filename1):
return direct_load_image(filename1)
print('File not found: ', filename)
func load_image(name: String) -> ImageTexture:
var filename = find_file(name)
if filename != '':
return direct_load_image(filename)
print('File not found: ', name)
return fallback_texture

View File

@ -1,6 +1,45 @@
tool
extends Node
var tex_notes := preload('res://assets/spritesheet-2048.png')
var tex_judgement_text := preload('res://assets/text-4k.png')
var tex_slide_arrow := tex_notes
var slide_trail_shadermaterial := preload('res://shaders/slidetrail.tres')
var snd_miss := preload('res://assets/miss.wav')
var snd_clap := preload('res://assets/softclap.wav')
var snd_count_in := snd_clap
var snd_judgement := {
0: snd_clap,
1: snd_clap,
-1: snd_clap,
2: snd_clap,
-2: snd_clap,
3: snd_miss,
-3: snd_miss,
'MISS': snd_miss
}
var db_judgement := {
0: 0.0,
1: -1.5,
-1: -1.5,
2: -3.0,
-2: -3.0,
3: -6.0,
-3: -6.0,
'MISS': 0.0
}
var pitch_judgement := {
0: 1.0,
-1: 1.0/0.75,
1: 0.75,
-2: 1.0/0.60,
2: 0.60,
-3: 1.5,
3: 1.5,
'MISS': 1.0
}
var receptor_ring_radius := 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
@ -23,16 +62,29 @@ var judge_text_duration := 2.0
# UV vertex arrays for our sprites
# tap/star/arrow are 4-vertex 2-triangle simple squares
# hold is 8-vertex 6-triangle to enable stretching in the middle
const UV_ARRAY_TAP := PoolVector2Array([Vector2(0, 0.5), Vector2(0.5, 0.5), Vector2(0, 1), Vector2(0.5, 1)])
const TNSZ := 4;
const UV_ARRAY_TAP := PoolVector2Array([Vector2(0, 0)/TNSZ, Vector2(1, 0)/TNSZ, Vector2(0, 1)/TNSZ, Vector2(1, 1)/TNSZ])
const UV_ARRAY_HOLD := PoolVector2Array([
Vector2(0.5, 0.5), Vector2(1, 0.5), Vector2(0.5, 0.75), Vector2(1, 0.75),
Vector2(0.5, 0.75), Vector2(1, 0.75), Vector2(0.5, 1), Vector2(1, 1)
Vector2(1, 0)/TNSZ, Vector2(2, 0)/TNSZ, Vector2(1, 0.5)/TNSZ, Vector2(2, 0.5)/TNSZ,
Vector2(1, 0.5)/TNSZ, Vector2(2, 0.5)/TNSZ, Vector2(1, 1)/TNSZ, Vector2(2, 1)/TNSZ
])
const UV_ARRAY_STAR := PoolVector2Array([Vector2(0.5, 0), Vector2(1, 0), Vector2(0.5, 0.5), Vector2(1, 0.5)])
const UV_ARRAY_ARROW := PoolVector2Array([Vector2(0, 0), Vector2(0.5, 0), Vector2(0, 0.5), Vector2(0.5, 0.5)])
const UV_ARRAY_STAR := PoolVector2Array([Vector2(2, 0)/TNSZ, Vector2(3, 0)/TNSZ, Vector2(2, 1)/TNSZ, Vector2(3, 1)/TNSZ])
const UV_ARRAY_ARROW := PoolVector2Array([Vector2(0, 1)/TNSZ, Vector2(1, 1)/TNSZ, Vector2(0, 2)/TNSZ, Vector2(1, 2)/TNSZ])
# Slide trail arrow. Single tri.
const UV_ARRAY_SLIDE_ARROW := PoolVector2Array([Vector2(0, 0), Vector2(1, 0), Vector2(0, 1)])
const UV_ARRAY_SLIDE_ARROW2 := PoolVector2Array([Vector2(1, 1), Vector2(0, 1), Vector2(1, 0)])
const UV_ARRAY_SLIDE_ARROW := PoolVector2Array([Vector2(3, 0)/TNSZ, Vector2(4, 0)/TNSZ, Vector2(3, 1)/TNSZ])
const UV_ARRAY_SLIDE_ARROW2 := PoolVector2Array([Vector2(4, 1)/TNSZ, Vector2(3, 1)/TNSZ, Vector2(4, 0)/TNSZ])
# Dance mode
const UV_ARRAY_D_ARROW := PoolVector2Array([Vector2(0, 2)/TNSZ, Vector2(1, 2)/TNSZ, Vector2(0, 3)/TNSZ, Vector2(1, 3)/TNSZ])
const UV_ARRAY_D_RECEPTOR := PoolVector2Array([Vector2(0, 3)/TNSZ, Vector2(1, 3)/TNSZ, Vector2(0, 4)/TNSZ, Vector2(1, 4)/TNSZ])
const UV_ARRAY_D_HOLD := PoolVector2Array([
Vector2(1, 1)/TNSZ, Vector2(2, 1)/TNSZ, Vector2(1, 1.5)/TNSZ, Vector2(2, 1.5)/TNSZ,
Vector2(1, 1.5)/TNSZ, Vector2(2, 1.5)/TNSZ, Vector2(1, 2)/TNSZ, Vector2(2, 2)/TNSZ
])
const UV_ARRAY_D_ROLL := PoolVector2Array([
Vector2(2, 1)/TNSZ, Vector2(3, 1)/TNSZ, Vector2(2, 1.5)/TNSZ, Vector2(3, 1.5)/TNSZ,
Vector2(2, 1.5)/TNSZ, Vector2(3, 1.5)/TNSZ, Vector2(2, 2)/TNSZ, Vector2(3, 2)/TNSZ
])
# Color definitions
const COLOR_TAP := Color(1, 0.15, 0.15, 1)
@ -54,28 +106,28 @@ const COLOR_DIFFICULTY := PoolColorArray([ # Background, foreground for each
Color(1.0, 1.0, 1.0), Color(0.737, 0.188, 0.894),
])
var COLOR_ARRAY_TAP := PoolColorArray([COLOR_TAP, COLOR_TAP, COLOR_TAP, COLOR_TAP])
var COLOR_ARRAY_TAP2 := PoolColorArray([COLOR_TAP2, COLOR_TAP2, COLOR_TAP2, COLOR_TAP2])
var COLOR_ARRAY_HOLD := PoolColorArray([
const COLOR_ARRAY_TAP := PoolColorArray([COLOR_TAP, COLOR_TAP, COLOR_TAP, COLOR_TAP])
const COLOR_ARRAY_TAP2 := PoolColorArray([COLOR_TAP2, COLOR_TAP2, COLOR_TAP2, COLOR_TAP2])
const COLOR_ARRAY_HOLD := PoolColorArray([
COLOR_HOLD, COLOR_HOLD, COLOR_HOLD, COLOR_HOLD,
COLOR_HOLD, COLOR_HOLD, COLOR_HOLD, COLOR_HOLD
])
var COLOR_ARRAY_HOLD_HELD := PoolColorArray([
const COLOR_ARRAY_HOLD_HELD := PoolColorArray([
COLOR_HOLD_HELD, COLOR_HOLD_HELD, COLOR_HOLD_HELD, COLOR_HOLD_HELD,
COLOR_HOLD_HELD, COLOR_HOLD_HELD, COLOR_HOLD_HELD, COLOR_HOLD_HELD
])
var COLOR_ARRAY_HOLD_MISS := PoolColorArray([
const COLOR_ARRAY_HOLD_MISS := PoolColorArray([
COLOR_HOLD_MISS, COLOR_HOLD_MISS, COLOR_HOLD_MISS, COLOR_HOLD_MISS,
COLOR_HOLD_MISS, COLOR_HOLD_MISS, COLOR_HOLD_MISS, COLOR_HOLD_MISS
])
var COLOR_ARRAY_STAR := PoolColorArray([COLOR_STAR, COLOR_STAR, COLOR_STAR, COLOR_STAR])
var COLOR_ARRAY_DOUBLE_4 := PoolColorArray([COLOR_DOUBLE, COLOR_DOUBLE, COLOR_DOUBLE, COLOR_DOUBLE])
var COLOR_ARRAY_DOUBLE_8 := PoolColorArray([
const COLOR_ARRAY_STAR := PoolColorArray([COLOR_STAR, COLOR_STAR, COLOR_STAR, COLOR_STAR])
const COLOR_ARRAY_DOUBLE_4 := PoolColorArray([COLOR_DOUBLE, COLOR_DOUBLE, COLOR_DOUBLE, COLOR_DOUBLE])
const COLOR_ARRAY_DOUBLE_8 := PoolColorArray([
COLOR_DOUBLE, COLOR_DOUBLE, COLOR_DOUBLE, COLOR_DOUBLE,
COLOR_DOUBLE, COLOR_DOUBLE, COLOR_DOUBLE, COLOR_DOUBLE
])
var COLOR_ARRAY_DOUBLE_MISS_4 := PoolColorArray([COLOR_DOUBLE_MISS, COLOR_DOUBLE_MISS, COLOR_DOUBLE_MISS, COLOR_DOUBLE_MISS])
var COLOR_ARRAY_DOUBLE_MISS_8 := PoolColorArray([
const COLOR_ARRAY_DOUBLE_MISS_4 := PoolColorArray([COLOR_DOUBLE_MISS, COLOR_DOUBLE_MISS, COLOR_DOUBLE_MISS, COLOR_DOUBLE_MISS])
const COLOR_ARRAY_DOUBLE_MISS_8 := PoolColorArray([
COLOR_DOUBLE_MISS, COLOR_DOUBLE_MISS, COLOR_DOUBLE_MISS, COLOR_DOUBLE_MISS,
COLOR_DOUBLE_MISS, COLOR_DOUBLE_MISS, COLOR_DOUBLE_MISS, COLOR_DOUBLE_MISS
])

View File

@ -213,7 +213,7 @@ func _draw_score_screen(center: Vector2) -> Array:
var y1 = y
var y2 = y + size + y_spacing*1.5
var tex_judgement_text = NoteHandler.tex_judgement_text
var tex_judgement_text = GameTheme.tex_judgement_text
var judgement_text_scale = 0.667
var judgement_text_width = 256 * judgement_text_scale
var judgement_text_height = 64 * judgement_text_scale

View File

@ -7,11 +7,6 @@ signal finished_song(song_key, score_data)
var running := false
var song_key = ''
var tex := preload('res://assets/spritesheet-4k.png')
var tex_judgement_text := preload('res://assets/text-4k.png')
var tex_slide_arrow := preload('res://assets/slide-arrow-4k.png')
var slide_trail_shadermaterial := preload('res://shaders/slidetrail.tres')
export var MusicPlayerPath := @'/root/main/music'
export var VideoPlayerPath := @'/root/main/video'
export var InputHandlerPath := @'/root/main/InputHandler'
@ -25,40 +20,6 @@ onready var JudgeText = $'Viewport/Center/JudgeText'
onready var notelines = $'Viewport/Center/notelines'
onready var meshinstance = $'Viewport/Center/meshinstance'
var snd_miss := preload('res://assets/miss.wav')
var snd_clap := preload('res://assets/softclap.wav')
var snd_count_in := snd_clap
var snd_judgement := {
0: snd_clap,
1: snd_clap,
-1: snd_clap,
2: snd_clap,
-2: snd_clap,
3: snd_miss,
-3: snd_miss,
'MISS': snd_miss
}
var db_judgement := {
0: 0.0,
1: -1.5,
-1: -1.5,
2: -3.0,
-2: -3.0,
3: -6.0,
-3: -6.0,
'MISS': 0.0
}
var pitch_judgement := {
0: 1.0,
-1: 1.0/0.75,
1: 0.75,
-2: 1.0/0.60,
2: 0.60,
-3: 1.5,
3: 1.5,
'MISS': 1.0
}
const SQRT2 := sqrt(2)
const DEG45 := deg2rad(45.0)
const DEG90 := deg2rad(90.0)
@ -280,12 +241,12 @@ func make_slide_trail_mesh(note) -> ArrayMesh:
#----------------------------------------------------------------------------------------------------------------------------------------------
func make_judgement_column(judgement, column: int):
active_judgement_texts.append({col=column, judgement=judgement, time=t})
SFXPlayer.play(SFXPlayer.Type.NON_POSITIONAL, self, snd_judgement[judgement], db_judgement[judgement], pitch_judgement[judgement])
SFXPlayer.play(SFXPlayer.Type.NON_POSITIONAL, self, GameTheme.snd_judgement[judgement], GameTheme.db_judgement[judgement], GameTheme.pitch_judgement[judgement])
func make_judgement_pos(judgement, pos: Vector2):
# Positional judgement text not yet implemented, will do if touches are ever added
#active_judgement_texts.append({judgement=judgement, time=t})
SFXPlayer.play(SFXPlayer.Type.NON_POSITIONAL, self, snd_judgement[judgement], db_judgement[judgement], pitch_judgement[judgement])
SFXPlayer.play(SFXPlayer.Type.NON_POSITIONAL, self, GameTheme.snd_judgement[judgement], GameTheme.db_judgement[judgement], GameTheme.pitch_judgement[judgement])
func activate_note(note, judgement):
@ -464,7 +425,7 @@ func _draw():
slide_trail_mesh_instances[note.slide_id].material.set_shader_param('base_alpha', trail_alpha*GameTheme.slide_trail_alpha)
noteline_data.unlock()
var noteline_data_tex = ImageTexture.new()
var noteline_data_tex := ImageTexture.new()
noteline_data_tex.create_from_image(noteline_data, 0)
notelines.set_texture(noteline_data_tex)
@ -592,7 +553,7 @@ func load_track(song_key: String, difficulty_idx: int):
meshinstance.material.set_shader_param('held_color', GameTheme.COLOR_HOLD_HELD)
meshinstance.material.set_shader_param('bps', bpm/60.0)
meshinstance.material.set_shader_param('screen_size', get_viewport().get_size())
meshinstance.set_texture(tex)
meshinstance.set_texture(GameTheme.tex_notes)
initialise_scores() # Remove old score
func stop():
@ -602,7 +563,7 @@ func stop():
next_note_to_load = 1000000 # Hacky but whatever
func intro_click():
SFXPlayer.play(SFXPlayer.Type.NON_POSITIONAL, self, snd_count_in)
SFXPlayer.play(SFXPlayer.Type.NON_POSITIONAL, self, GameTheme.snd_count_in)
func get_realtime_precise() -> float:
# Usually we only update the gametime once per process loop, but for input callbacks it's good to have msec precision
@ -710,9 +671,9 @@ func _process(delta):
if note.type == Note.NOTE_SLIDE:
var meshi = MeshInstance2D.new()
meshi.set_mesh(slide_trail_meshes[note.slide_id])
meshi.set_material(slide_trail_shadermaterial.duplicate())
meshi.set_material(GameTheme.slide_trail_shadermaterial.duplicate())
meshi.material.set_shader_param('trail_progress', 0.0)
meshi.set_texture(tex_slide_arrow)
meshi.set_texture(GameTheme.tex_slide_arrow)
slide_trail_mesh_instances[note.slide_id] = meshi
SlideTrailHandler.add_child(meshi)