from osbpy import *
from math import *
songFolderPath = "C:/Path/To/Containing/Folder"
beat = 343
start = 686
end = 303086
imgScale = 0.6486452
gradient1_r = [255,237,213,184,152,118,85,54,27,7,0,0,0,0,0,0]
gradient1_g = [255,252,248,245,240,235,229,221,213,203,187,164,136,107,79,56]
gradient1_b = [255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255]
def clamp(val, low, high):
return min(max(val, low), high)
#Shooting Star Particles
def shootingStar(minSpeed, maxSpeed):
centerX = 320
centerY = 280
reflectY = 390
speed = randint(minSpeed, maxSpeed)
radius = randint(80, 430)#(1 - (randint(1, 1000)/1000)**2) * 350 + 80
trailLength = randint(40, 80)
lifeTime = randint(1000, 3000) * sqrt(radius) / speed
delay = randint(0, 5000)
starScale = randint(40, 70)/100 * sqrt(radius / 400)
fadeTimeA = randint(100, 1000)
fadeTimeB = randint(100, 1000)
radiusPercent = (radius - 80) / 350
colorId = int(radiusPercent * 16)
cR = gradient1_r[clamp(colorId + randint(-1, 1), 0, 15)]
cG = gradient1_g[clamp(colorId + randint(-1, 1), 0, 15)]
cB = 255
hasReflection = True#randint(0, 100) <= 30
for i in range(trailLength):
trailDelay = 5 * i;
trailFade = (trailLength - i) / trailLength
trailScale = starScale * trailFade
trailStartTime = trailDelay
star = osbject("sb/particle.png", "Background", "Centre", centerX + radius, centerY)
star.para(0, delay, end, "A")
star.scale(0, delay, end, trailScale, trailScale)
star.loop(delay + trailDelay, (end - delay - trailDelay) / lifeTime);
star.fade(0, 0, fadeTimeA, 0, trailFade, True)
star.fade(0, lifeTime - fadeTimeB, lifeTime, trailFade, 0, True)
star.moveX(17, 0, lifeTime, centerX + radius, centerX - radius, True)
star.moveY(16, 0, lifeTime/2, centerY, centerY - radius, True)
star.moveY(15, lifeTime/2, lifeTime, centerY - radius, centerY, True)
star.color(0, delay, end, cR, cG, cB, cR, cG, cB)
if hasReflection:
reflection = osbject("sb/particle.png", "Background", "Centre", centerX + radius, reflectY)
reflection.para(0, delay, end, "A")
reflection.scale(0, delay, end, trailScale, trailScale)
reflection.loop(delay + trailDelay, (end - delay - trailDelay) / lifeTime);
reflection.fade(0, 0, fadeTimeA, 0, trailFade, True)
reflection.fade(0, lifeTime - fadeTimeB, lifeTime, trailFade, 0, True)
reflection.moveX(17, 0, lifeTime, centerX + radius, centerX - radius, True)
reflection.moveY(16, 0, lifeTime/2, reflectY, reflectY + radius, True)
reflection.moveY(15, lifeTime/2, lifeTime, reflectY + radius, reflectY, True)
reflection.color(0, delay, end, cR/2, cG/2, cB/2, cR/2, cG/2, cB/2)
background = osbject("minasokobg2.jpg", "Background", "Centre", 320, 240)
background.scale(0, 0, end, imgScale, imgScale)
for i in range(100):
shootingStar(5, 10)
base = osbject("sb/base.png", "Background", "Centre", 320, 329)
base.scale(0, start, end, imgScale, imgScale)
topLight = osbject("sb/light.png", "Background", "TopCentre", 320, 0)
topLight.para(0, 0, end, "A")
topLight.vecscale(0, 0, end, 880, 2, 880, 2)
toggleTimes = []
beatmap = open(songFolderPath + "Reol - Minazoko Yuuhodou (The Fetish) [Abyss].osu", encoding="utf-8").readlines()
timingSections = []
beatmapParseState = 0
timingSectionId = 0
comboColor = 0
firstCombo = True
#Not actual combo colors, but colors that I want to correspond with the combo colors
light_comboR = [0, 0, 0, 0, 255, 255, 255, 255]
light_comboG = [0, 0, 128, 255, 0, 0, 180, 128]
light_comboB = [0, 0, 255, 128, 0, 128, 0, 0]
back_comboR = [148, 128, 126, 153, 221, 174, 255, 128]
back_comboG = [148, 128, 203, 228, 131, 131, 0, 128]
back_comboB = [148, 128, 224, 155, 161, 221, 0, 0]
for line in beatmap:
if beatmapParseState == 0:
if line == "[TimingPoints]\n":
beatmapParseState = 1
elif line == "[HitObjects]\n":
beatmapParseState = 2
elif beatmapParseState == 1: #Parse Timing Sections
if line == "\n":
beatmapParseState = 0
else:
timingSections.append(line.split(","))
elif beatmapParseState == 2: #Parse Hit Objects
hitObject = line.split(",")
currentTime = int(hitObject[2])
currentTimingSection = timingSections[timingSectionId]
if timingSectionId < len(timingSections) - 1:
nextTimingSection = timingSections[timingSectionId + 1]
if currentTime >= int(nextTimingSection[0]):
timingSectionId += 1
currentTimingSection = timingSections[timingSectionId]
sampleType = int(currentTimingSection[3])
sampleSet = int(currentTimingSection[4])
volume = int(currentTimingSection[5])
objectType = int(hitObject[3])
if firstCombo:
firstCombo = False
elif (objectType & 4) != 0:
prevComboColor = comboColor
comboIncrease = (objectType >> 4) + 1
comboColor += comboIncrease
comboColor %= 8
r1 = light_comboR[prevComboColor]
g1 = light_comboG[prevComboColor]
b1 = light_comboB[prevComboColor]
r2 = light_comboR[comboColor]
g2 = light_comboG[comboColor]
b2 = light_comboB[comboColor]
topLight.color(0, currentTime - beat/4, currentTime + beat/4, r1, g1, b1, r2, g2, b2)
r1 = back_comboR[prevComboColor]
g1 = back_comboG[prevComboColor]
b1 = back_comboB[prevComboColor]
r2 = back_comboR[comboColor]
g2 = back_comboG[comboColor]
b2 = back_comboB[comboColor]
background.color(0, currentTime - beat/4, currentTime + beat/4, r1, g1, b1, r2, g2, b2)
base.color(0, currentTime - beat/4, currentTime + beat/4, r1, g1, b1, r2, g2, b2)
light = osbject("minasokobg2.jpg", "Background", "Centre", 320, 240)
light.scale(0, 0, end, imgScale, imgScale)
light.para(0, 0, end, "A")
light.fade(0, 0, 23315, 0, 0.5)
light.fade(0, 44572, 45258, 0.5, 0)
light.fade(0, 53486, 56229, 0, 0.5)
light.fade(0, 76801, 77401, 0.5, 0)
light.fade(0, 77401, 78172, 0, 0.7)
light.fade(0, 99429, 100115, 0.7, 0.3)
light.fade(0, 100115, 120686, 0.3, 0.5)
light.fade(0, 144001, 144343, 0.5, 0)
light.fade(0, 154972, 164572, 0, 0.7)
light.fade(0, 164572, 165258, 0.7, 0)
light.fade(0, 165258, 165601, 0, 0.7)
light.fade(0, 165601, 165943, 0.7, 0)
light.fade(0, 198858, 207086, 0, 0.7)
light.fade(0, 207086, 208458, 0.7, 0)
light.fade(0, 209829, 210172, 1, 0.7)
light.fade(0, 219601, 220801, 0.7, 0)
light.fade(0, 220801, 221486, 1, 0.7)
light.fade(0, 221486, 222001, 0.7, 1)
light.fade(0, 222515, 223543, 0.7, 0)
light.fade(0, 223543, 223886, 1, 0.7)
light.fade(0, 224572, 224915, 0.7, 1)
light.fade(0, 226286, 229029, 1, 0.5)
light.fade(0, 229029, 229029 + beat/4, 0.6, 0.5)
light.fade(0, 229372, 229372 + beat/4, 0.6, 0.5)
light.fade(0, 229543, 229543 + beat/4, 0.6, 0.5)
light.fade(0, 229629, 229629 + beat/4, 0.6, 0.5)
light.fade(0, 229715, 229715 + beat/4, 0.6, 0.5)
light.fade(0, 230058, 230058 + beat/4, 0.6, 0.5)
light.fade(0, 230229, 230229 + beat/4, 0.6, 0.5)
light.fade(0, 230401, 230401 + beat/4, 0.7, 0.5)
light.fade(0, 230486, 230486 + beat/4, 0.7, 0.5)
light.fade(0, 230572, 230572 + beat/4, 0.7, 0.5)
light.fade(0, 230658, 230658 + beat/4, 0.7, 0.5)
light.fade(0, 230743, 230743 + beat/4, 0.8, 0.5)
light.fade(0, 230829, 230829 + beat/4, 0.8, 0.5)
light.fade(0, 230915, 230915 + beat/4, 0.8, 0.5)
light.fade(0, 231001, 231001 + beat/4, 0.8, 0.5)
light.fade(0, 231086, 231086 + beat, 1, 0)
light.fade(0, 231772, 233143, 1, 0.5)
light.fade(0, 252858, 253029, 0.5, 0)
light.fade(0, 253715, 254401, 1, 0.5)
light.fade(0, 275658, 277029, 0.5, 0)
black = osbject("sb/black.png", "Background", "Centre", 320, 240)
black.scale(0, 285258, end, imgScale, imgScale)
black.fade(0, 285258, end, 0, 1)
osbject.end(songFolderPath + "Reol - Minazoko Yuuhodou (The Fetish).osb")