Lag problem

Fill this out this info to make it easier for the community to help you! If you don’t fill out this information, your post may be deleted or removed.

What Wick Editor Version are you using?
I’m using 1.19.3

Describe the Problem
So, i was following @Jovanny 's tutorial on how to make a friday night funkin game.
It’s all good but when you miss the notes just go and never stop, and, if there are a lot of clones, the game starts to lag.

What have you tried so far?
I’ve tried to add a limit to the arrows so when they touch it they remove itself (this.remove()) but it just brings this error:

Error: Cannot read property ‘hitTestOptions’ of null on line 58020 in script update

Please, post the project so I can support you on that. (if you want…)

My guess is that the original copy got deleted, so a hitTest function where the original copy is being referred to threw an error (?).

Try using this code instead:

if(this.isClone){ // checks to see if the object is a clone
this.remove();   // Remove this object
}
1 Like

It is related to the classes… the ArrowManager has an Arrow array. Every element of that array is not a clip, it is an Object from the custom Arrow class that I made. Those Arrow objects contains an arrow clip… you can’t just remove the clips without removing the Arrow Object from the Arrow array… If you do that, then the ArrowManager will not know and it will try to call that clip…

The solution is to remove that element of the array when the clip y position reaches negative something…

why not making an line that is the same color as the background than use hit code

i mean up the arrows where you put line if this helped you please reply to me this is a little tip and trick on coding

i hope you liked it

Hey @Youyou @Hamzah_Alani @Jovanny

Thank you all for your help!

I wasn’t able to reduce all of the lag but reduced it a lot by removing arrows that were already invisible.

If you post the project, I can help you with the lag, I know how.

please share you secrets

fnf v2 (followed jovannys tutorial also fixed some lag)3-10-2021_14-41-11.wick (812.0 KB)

1 Like

Add these lines to your code, and it should be good to go in terms of performance…

image

1 Like

can you copy and paste

Nope, never… I will always want people to write it by themselves, so they can process it in their brain.

1 Like

thats going on the top ten reasons why jovanny is such a good mod

1 Like

Algo que noté @Steven es que las flechas van muy rápido… debes bajarle la intensidad… Otra cosa… los cuadros de las flechas estan muy grandes, debes ponerlas mas pequeñas, pero en resumen, buen trabajo! Si añades las 7 lineas de código que te puse en la foto, el lag debe desaparecer, al menos que tengas un Computadora con pocos recursos. Saludos.

Something that I noticed is that the arrows go too fast… you should lower their intensity… Another thing, The rectangles are too big, you should decrease their size, but summarizing, good job! If you add those code lines, the lag should disappear. Greetings.

1 Like

can you explain whats going on here?

Gracias!

Si ayudo!

Y tambien, me gusta que vayan rapido, es mas complicado asi!

Y tambien pensaba cambiar el diseño de las flechas, lo hare en algun momento.

Y, con esas lineas de codigo si funciona, ahora desaparecen una vez se van de la pantalla.

Y tambien, ahi hay una falta de ortografia, es “desaparecer”

Bueno, muchas gracias por tu ayuda!

1 Like

¿Quieres que te haga nuevas flechas?

Estoy bien, pero gracias por preguntar!

No problema! Have fun on your adventures with the wick editor!

1 Like