ShadowMario / FNF-PsychEngine

Engine originally used on Mind Games mod
Apache License 2.0
1.16k stars 2.23k forks source link

How do i make a mechanic. where a character covers the screen. to make him go away you need to press a note? #8224

Closed JacksRobotics closed 2 years ago

JacksRobotics commented 2 years ago

What is your question?

im making a mod called vs grunkfuss. on psych engine 0.5.2h and i want to add a mechanic. where birthday boy blam covers up the screen. to make him go away press a gray note. And no. im not using lua. Im useing source code

Steve35117 commented 2 years ago

`function onEvent(name, value1, value2) if name == "Boopsie" then makeLuaSprite('jiafeiProducts', value1, 0, 0) screenCenter('jiafeiProducts', 'XY') setObjectCamera('jiafeiProducts', 'camHUD')--or camgame or camother idc asdfgh playSound(value2, 187) addLuaSprite('jiafeiProducts', true) end end

function onUpdate(noteType) if getPropertyFromClass('flixel.FlxG', 'keys.justPressed.SIX') then -- put whatever you want(type your key on uppercase) doTweenAlpha('cupcakke', 'jiafeiProducts', 0, 1, 'linear') end if noteType == 'graynote' then doTweenAlpha('cupcakke', 'jiafeiProducts', 0, 1, 'linear') end end

function onTweenCompleted(tag) -- reduce lag if tag == 'cupcakke' then removeLuaSprite('jiafeiProducts') end end`

Steve35117 commented 2 years ago

`function onEvent(name, value1, value2) if name == "Boopsie" then makeLuaSprite('jiafeiProducts', value1, 0, 0) screenCenter('jiafeiProducts', 'XY') setObjectCamera('jiafeiProducts', 'camHUD')--or camgame or camother idc asdfgh playSound(value2, 187) addLuaSprite('jiafeiProducts', true) end end

function onUpdate(noteType) if getPropertyFromClass('flixel.FlxG', 'keys.justPressed.SIX') then -- put whatever you want(type your key on uppercase) doTweenAlpha('cupcakke', 'jiafeiProducts', 0, 1, 'linear') end if noteType == 'graynote' then doTweenAlpha('cupcakke', 'jiafeiProducts', 0, 1, 'linear') end end

function onTweenCompleted(tag) -- reduce lag if tag == 'cupcakke' then removeLuaSprite('jiafeiProducts') end end`

btw value 2 is optional

JacksRobotics commented 2 years ago

thankss

Steve35117 commented 2 years ago

since its an event, yes (on custom_events), also you could put it on your song but replace the onEvent with onStepHit and the if name thing with if curstep == ex.1

Am Di., 19. Apr. 2022 um 16:38 Uhr schrieb Jacks Robotics < @.***>:

also where do i put this code? in mods folder?

— Reply to this email directly, view it on GitHub https://github.com/ShadowMario/FNF-PsychEngine/issues/8224#issuecomment-1102736164, or unsubscribe https://github.com/notifications/unsubscribe-auth/AWWCVPO7CLEK2GLTZ7WXJCTVF3AMLANCNFSM5TY2UZ2Q . You are receiving this because you commented.Message ID: @.***>

Steve35117 commented 2 years ago

`function onEvent(name, value1, value2) if name == "Boopsie" then makeLuaSprite('jiafeiProducts', value1, 0, 0) screenCenter('jiafeiProducts', 'XY') setObjectCamera('jiafeiProducts', 'camHUD')--or camgame or camother idc asdfgh playSound(value2, 187) addLuaSprite('jiafeiProducts', true) end end

function onUpdate(noteType) if getPropertyFromClass('flixel.FlxG', 'keys.justPressed.SIX') then -- put whatever you want(type your key on uppercase) doTweenAlpha('cupcakke', 'jiafeiProducts', 0, 1, 'linear') end if noteType == 'graynote' then doTweenAlpha('cupcakke', 'jiafeiProducts', 0, 1, 'linear') end end

function onTweenCompleted(tag) -- reduce lag if tag == 'cupcakke' then removeLuaSprite('jiafeiProducts') end end`

`function makeShit() { jiafeiProducts = new FlxSprite().loadGraphic(Paths.image(image path or value1 if its an event)); jiafeiProducts.screenCenter(); jiafeiProducts.cameras = [camHUD]; //or camgame or camother idc asdfgh FlxG.sound.play(Paths.sound(sound Path or value2), 187); add(jiafeiProducts); }

function goodNoteHit() { if (note.noteType == 'graynote'){ FlxTween.tween(jiafeiProducts, {alpha: 0}, 1, {ease:FlxEase.sineOut, onComplete: function(twn:FlxTween) { remove(jiafeiProducts); // reduce lag } }); } }

function update(elapsed) { if (FlxG.keys.justPressed.SIX) { // put whatever you want(type your key on uppercase) FlxTween.tween(jiafeiProducts, {alpha: 0}, 1, {ease:FlxEase.sineOut, onComplete: function(twn:FlxTween) { remove(jiafeiProducts); // reduce lag } }); } if(SONG.song.toLowerCase() == 'song'// && FlxG.random.bool(50)) { makeShit(); /* switch(curStep/beat) { case 5: makeShit(); } } }`

Ive realized its on source. if anything is wrong, tell me

JacksRobotics commented 2 years ago

thanks so much for the code. your a awsome guy!

JacksRobotics commented 2 years ago

hey when i test the game and put the event. it says Mods/Custom_events/BBB Mechanic.lua1: unexpected symbol near

JacksRobotics commented 2 years ago

anyway to fix this?