ShadowMario / FNF-PsychEngine

Engine originally used on Mind Games mod
Apache License 2.0
1.11k stars 2.18k forks source link

How to make notes move? #431

Closed Charmandorp357 closed 2 years ago

Charmandorp357 commented 2 years ago

ive been watching some fnf mod videos lately, and i was wondering how to make the arrows move like in cheating here ill leave a link and show what i mean: https://youtu.be/em-87F0UL-w

so how do i make the arrows move through code?

nintendofan44 commented 2 years ago

that is a modchart but idk how to do it in psych engine

lemz1 commented 2 years ago

(This is the movement of Cheating, maybe a bit faster) hi, so first go to FunkinLua.hx and set a new variable to Song/Week shit: set('songPos', Conductor.songPosition);

then make a new file named "script.lua" and put it in the folder with the charts for the song (the folder with the json files.) in this script write this:

function onUpdate(elapsed)
    if curStep >= 0 and curStep < 769 then
        songPos = getSongPosition()
        local currentBeat = (songPos/5000)*(curBpm/60)

        noteTweenX(defaultPlayerStrumX0, 4, defaultPlayerStrumX0 - 50*math.sin((currentBeat+4*0.25)*math.pi), 0.5)
        noteTweenX(defaultPlayerStrumX1, 5, defaultPlayerStrumX1 - 350 + 2000*math.sin((currentBeat+8*0.25)*math.pi), 3)
        noteTweenX(defaultPlayerStrumX2, 6, defaultPlayerStrumX2 - 50*math.sin((currentBeat+4*0.25)*math.pi), 0.5)
        noteTweenX(defaultPlayerStrumX3, 7, defaultPlayerStrumX3 - 350 + 2000*math.sin((currentBeat+8*0.25)*math.pi), 3)

        noteTweenX(defaultOpponentStrumX0, 0, defaultOpponentStrumX0 + 50*math.sin((currentBeat+4*0.25)*math.pi), 0.5)
        noteTweenX(defaultOpponentStrumX1, 1, defaultOpponentStrumX1 + 350 - 2000*math.sin((currentBeat+8*0.25)*math.pi), 3)
        noteTweenX(defaultOpponentStrumX2, 2, defaultOpponentStrumX2 + 50*math.sin((currentBeat+4*0.25)*math.pi), 0.5)
        noteTweenX(defaultOpponentStrumX3, 3, defaultOpponentStrumX3 + 350 - 2000*math.sin((currentBeat+8*0.25)*math.pi), 3)

    end
end

the number directly before math.sin (50 and 2000) defines the strength of the movement the number that are not directly before math.sin (350) defines the offset of the note: -350 means 350 pixels to the left the last number (0.5 and 3) defines how fast the movements are the higher the number the slower the movement. But if the movement is slower the range of the movement is also smaller.

ItsCapp commented 2 years ago

what if I wanted to move the arrows later in the song? like I wanted to trigger it or something

ItsJayPM commented 2 years ago

what if I wanted to move the arrows later in the song? like I wanted to trigger it or something

you'd change the range of the curStep if statement near the top.

Cristobal653 commented 2 years ago

ive been watching some fnf mod videos lately, and i was wondering how to make the arrows move like in cheating here ill leave a link and show what i mean: https://youtu.be/em-87F0UL-w

so how do i make the arrows move through code?

Here ya go.

function onUpdate(elapsed)songPos = getSongPosition()

local currentBeat = (songPos/5000)*(curBpm/24)

noteTweenX(defaultPlayerStrumX0, 4, ((screenWidth / 2) - (157 / 2)) + (math.sin((currentBeat) + 0) * 300), 0.001)
noteTweenX(defaultPlayerStrumX1, 5, ((screenWidth / 2) - (157 / 2)) + (math.sin((currentBeat) + 1) * 300), 0.001)
noteTweenX(defaultPlayerStrumX2, 6, ((screenWidth / 2) - (157 / 2)) + (math.sin((currentBeat) + 2) * 300), 0.001)
noteTweenX(defaultPlayerStrumX3, 7, ((screenWidth / 2) - (157 / 2)) + (math.sin((currentBeat) + 3) * 300), 0.001)
noteTweenY('defaultPlayerStrumY0', 4, ((screenHeight / 2) - (157 / 2)) + (math.cos((currentBeat) + 0) * 300), 0.001)
noteTweenY('defaultPlayerStrumY1', 5, ((screenHeight / 2) - (157 / 2)) + (math.cos((currentBeat) + 1) * 300), 0.001)
noteTweenY('defaultPlayerStrumY2', 6, ((screenHeight / 2) - (157 / 2)) + (math.cos((currentBeat) + 2) * 300), 0.001)
noteTweenY('defaultPlayerStrumY3', 7, ((screenHeight / 2) - (157 / 2)) + (math.cos((currentBeat) + 3) * 300), 0.001)
noteTweenX('fake1', 0, ((screenWidth / 2) - (157 / 2)) + (math.sin((currentBeat) + (4) * 2) * 300), 0.001)
noteTweenX('fake2', 1, ((screenWidth / 2) - (157 / 2)) + (math.sin((currentBeat) + (5) * 2) * 300), 0.001)
noteTweenX('fake3', 2, ((screenWidth / 2) - (157 / 2)) + (math.sin((currentBeat) + (6) * 2) * 300), 0.001)
noteTweenX('fake4', 3, ((screenWidth / 2) - (157 / 2)) + (math.sin((currentBeat) + (7) * 2) * 300), 0.001)
noteTweenY('defaultFPlayerStrumY0', 0, ((screenHeight / 2) - (157 / 2)) + (math.cos((currentBeat) + (4) * 2) * 300), 0.001)
noteTweenY('defaultFPlayerStrumY1', 1, ((screenHeight / 2) - (157 / 2)) + (math.cos((currentBeat) + (5) * 2) * 300), 0.001)
noteTweenY('defaultFPlayerStrumY2', 2, ((screenHeight / 2) - (157 / 2)) + (math.cos((currentBeat) + (6) * 2) * 300), 0.001)
noteTweenY('defaultFPlayerStrumY3', 3, ((screenHeight / 2) - (157 / 2)) + (math.cos((currentBeat) + (7) * 2) * 300), 0.001)
end

Edit: oh wait that was Unfairness modchart

theoneandonlystupid commented 2 years ago

how do i make notes move like this https://youtu.be/d_Gs1j1Keaw

You-are-T00-SL0W commented 2 years ago

how to make notes spin like in disabillity

balargueye commented 2 years ago

how to make notes go like this https://www.youtube.com/watch?v=Fvb1kjeIheY

Caleb8Cameron commented 2 years ago

I Want Them To move Like In The Song Disability

Hottrends2406 commented 1 year ago

idk.txt a script that makes two arrows go up and two arrows go down (and vice versa)

Bonavara commented 1 month ago

I Want Them To move Like In The Song Disability

Here u go

function onUpdate(elapsed) if curStep >= 0 and curStep < 769 then songPos = getSongPosition() local currentBeat = (songPos/5000)*(curBpm/60) noteTweenX(defaultPlayerStrumX0, 4, defaultPlayerStrumX0 - (math.sin((currentBeat/10)*100))*200, 0.5) noteTweenY("NoteMove1", 4, 0 - ((math.cos((currentBeat/10)*100))*150) + 75, 0.5, cubeInOut) noteTweenX(defaultPlayerStrumX1, 5, defaultPlayerStrumX1 + (math.sin((currentBeat/10)*100))*200, 0.5, cubeInOut) noteTweenY("NoteMove2", 5, ((math.cos((currentBeat/10)*100))*150) + 75, 0.5, cubeInOut) noteTweenX(defaultPlayerStrumX2, 6, defaultPlayerStrumX2 - (math.sin((currentBeat/10)*100))*200, 0.5, cubeInOut) noteTweenY("NoteMove3", 6, 0 - ((math.cos((currentBeat/10)*100))*150) + 75, 0.5, cubeInOut) noteTweenX(defaultPlayerStrumX3, 7, defaultPlayerStrumX3 + (math.sin((currentBeat/10)*100))*200, 0.5, cubeInOut) noteTweenY("NoteMove4", 7, ((math.cos((currentBeat/10)*100))*150) + 75, 0.5, cubeInOut) noteTweenX(defaultOpponentStrumX0, 0, defaultOpponentStrumX0 - (math.sin((currentBeat/10)*100))*200, 0.5, cubeInOut) noteTweenX(defaultOpponentStrumX1, 1, defaultOpponentStrumX1 + (math.sin((currentBeat/10)*100))*200, 0.5, cubeInOut) noteTweenX(defaultOpponentStrumX2, 2, defaultOpponentStrumX2 - (math.sin((currentBeat/10)*100))*200, 0.5, cubeInOut) noteTweenX(defaultOpponentStrumX3, 3, defaultOpponentStrumX3 + (math.sin((currentBeat/10)*100))*200, 0.5, cubeInOut) noteTweenY("NoteMove5", 0, 0 - ((math.cos((currentBeat/10)*100))*150) + 75, 0.5, cubeInOut) noteTweenY("NoteMove6", 1, ((math.cos((currentBeat/10)*100))*150) + 75, 0.5, cubeInOut) noteTweenY("NoteMove7", 2, 0 - ((math.cos((currentBeat/10)*100))*150) + 75, 0.5, cubeInOut) noteTweenY("NoteMove8", 3, ((math.cos((currentBeat/10)*100))*150) + 75, 0.5, cubeInOut) end end

Sorry, but im new to github so that happened, and it's okay to put that to script.lua, still work.