i made all of these things
ill update this as i find more scripts that ive made that are actually somewhat useful
script that allows you to position sprites exactly (you can print out the x and y coords by pressing T)
this is probably the most useful script here i use it like every time i am making a stage
char = 'PUT SPRITE NAME HERE'
origBitch = 10
bitch = origBitch
function onUpdate()
if getPropertyFromClass('flixel.FlxG', 'keys.pressed.LEFT') then
setProperty(char..'.x', getProperty(char..'.x') - bitch)
elseif getPropertyFromClass('flixel.FlxG', 'keys.pressed.RIGHT') then
setProperty(char..'.x', getProperty(char..'.x') + bitch)
end
if getPropertyFromClass('flixel.FlxG', 'keys.pressed.DOWN') then
setProperty(char..'.y', getProperty(char..'.y') + bitch)
elseif getPropertyFromClass('flixel.FlxG', 'keys.pressed.UP') then
setProperty(char..'.y', getProperty(char..'.y') - bitch)
end
if getPropertyFromClass('flixel.FlxG', 'keys.justPressed.T') then
debugPrint(getProperty(char..'.x')..', ', getProperty(char..'.y'))
end
if getPropertyFromClass('flixel.FlxG', 'keys.pressed.SHIFT') then
bitch = origBitch*2
end
if getPropertyFromClass('flixel.FlxG', 'keys.pressed.CONTROL') then
bitch = origBitch/2
else
bitch = origBitch
end
end
cooler timers that work kinda like haxeflixel timeres :))):
timers = {}
function ezTimer(tag, timer, callback)
table.insert(timers,{tag, callback})
runTimer(tag, timer)
end
function onTimerCompleted(tag)
for k,v in pairs(timers) do
if v[1] == tag then
v[2]()
end
end
end
--example here you casn deletet this
function onCreate()
ezTimer('stupid idiot', 2.5, function() --makes a timer that finishes in 2.5 seconds, all timers still have to have unique names!
debugPrint('cool awesome amazing epic!')
end)
end
same thing as before but with tweens
tweens = {}
types = {}
function ezTween(type, tag, vars, value, duration, ease, callBack)
if types[type] == nil then
debugPrint('ezTween error! invalid type! stupid!')
return;
end
table.insert(tweens, {tag, callBack})
types[type](tag, vars, value, duration, ease)
end
function onTweenCompleted(tag)
for k,tween in pairs(tweens) do
if tween[1] == tag then
tween[2]()
end
end
end
function onCreate()
luaDebugMode = true;
types = { --important!!!
['x'] = doTweenX,
['y'] = doTweenY,
['angle'] = doTweenAngle,
['alpha'] = doTweenAlpha,
['color'] = doTweenColor,
['zoom'] = doTweenZoom,
['notex'] = noteTweenX,
['notey'] = noteTweenY,
['noteangle'] = noteTweenAngle,
['notealpha'] = noteTweenAlpha
}
end
--EXAMPLE you can delete this
function onCreatePost()
ezTween('angle', 'stupid', 'boyfriend', 360, 2, 'cubeIn', function() --tweens boyfriend's angle to 360 in two seconds!
debugPrint('oh yea!')
end)
end
code for an event that blacks out the entire screen:
blocking = false
prev = {}
function onCreate()
makeLuaSprite('blocker', '', -250, -250)
makeGraphic('blocker', 1920, 2000, '000000')
setObjectCamera('blocker', 'other')
setProperty('blocker.visible', false)
addLuaSprite('blocker', true)
setPropertyFromClass('openfl.Lib', 'application.window.width', 1280)
setPropertyFromClass('openfl.Lib', 'application.window.height', 720)
setPropertyFromClass('flixel.FlxG', 'fullscreen', true)
screenRes = {x = getPropertyFromClass('openfl.Lib','application.window.width'), y = getPropertyFromClass('openfl.Lib','application.window.height')}
setPropertyFromClass('flixel.FlxG', 'fullscreen', false)
prev = {x = getPropertyFromClass('openfl.Lib','application.window.x'), y = getPropertyFromClass('openfl.Lib','application.window.y')}
end
function onEvent(n)
if n == 'flash entire screen' then
blocking = not blocking
blockingCheck()
end
end
function blockingCheck()
setProperty('blocker.visible', blocking)
setPropertyFromClass('openfl.Lib', 'application.window.width', blocking and screenRes.x or 1280)
setPropertyFromClass('openfl.Lib', 'application.window.height', blocking and screenRes.y or 720)
setPropertyFromClass('openfl.Lib','application.window.x', blocking and 0 or prev.x)
setPropertyFromClass('openfl.Lib','application.window.y', blocking and 0 or prev.y)
end
indexOf and contains in lua
function indexOf(var, table) --returns the index of something in a table
for k,v in pairs(table) do
if v == var then
return k;
end
end
end
function contains(var, table)
for k,v in pairs(table) do
if v == var then
return true;
end
end
end
THIS IS THE ONLY THING I DIDNT MAKE BUT I THINK PEOPLE SHOULD KNOW ABOUT IT CAUSE IT WORKS BETTER THAN THE ONE BUILT INTO PSYCH!!!
function split(inputstr, sep)
if sep == nil then
sep = "%s"
end
local t={}
for str in string.gmatch(inputstr, "([^"..sep.."]+)") do
table.insert(t, str)
end
return t
end
makes a table into a string awesome
function tableToString(table, sep) --turns a table into a string (ex: {'nice', 'cool', 3} -> 'nice, cool, 3')
str = ''
for k,v in pairs(table) do
if k ~= #table then
str = str..v..sep
else
str = str..v
end
end
return str;
end
disruption modchart from dnb mod awesome!!!:
krunkthing = 30
playerArrowsX = {732, 844, 956, 1068}
opponentArrowsX = {92, 204, 316, 428}
names = {'opponentStrums', 'playerStrums'}
function onCreatePost()
strumY = getPropertyFromClass('clientPrefs', 'downscroll') == true and 560 or 40
end
function onUpdate()
songPos = getSongPosition()
currentBeat = (songPos/5000)*(curBpm/60)
if not inGameOver then
for i=1,2,1 do
local daName = names[i]
local daStrums = i == 2 and playerArrowsX or opponentArrowsX
for i=0,3,1 do
local huh = math.fmod(i, 2) == 0 and 1 or -1
setPropertyFromGroup(daName, i, 'x', daStrums[i+1] + math.sin(currentBeat) * huh * krunkthing)
setPropertyFromGroup(daName, i, 'y', strumY + math.sin(currentBeat - 5) * huh * krunkthing)
setPropertyFromGroup(daName, i, 'scale.x', math.abs(math.sin(currentBeat - 5) * huh) / 4)
setPropertyFromGroup(daName, i, 'scale.y', math.abs(math.sin(currentBeat) * huh) / 2)
setPropertyFromGroup(daName, i, 'scale.x', getPropertyFromGroup(daName, i, 'scale.x') + 0.2)
setPropertyFromGroup(daName, i, 'scale.y', getPropertyFromGroup(daName, i, 'scale.y') + 0.2)
setPropertyFromGroup(daName, i, 'scale.x', getPropertyFromGroup(daName, i, 'scale.x') * 1.5)
setPropertyFromGroup(daName, i, 'scale.y', getPropertyFromGroup(daName, i, 'scale.y') * 1.5)
end
end
for i = 0, getProperty('notes.length')-1 do
local daName = getPropertyFromGroup('notes', i, 'mustPress') == true and names[1] or names[2]
setPropertyFromGroup('notes', i, 'scale.x', getPropertyFromGroup(daName, getPropertyFromGroup('notes', i, 'noteData'), 'scale.x'));
setPropertyFromGroup('notes', i, 'scale.y', getPropertyFromGroup(daName, getPropertyFromGroup('notes', i, 'noteData'), 'scale.y'));
end
end
end