Dragonball Z-Themed Final Project (Need help with animations)

Hi everyone, I’m just doing my Simon-Says project for to (finally) finish off my Front end certificate. I turned it into a fighting game, for which the button sequences initiate moves. The problem is that the animations are really buggy. Here are the details:
-The project is here: https://codepen.io/jonnnyk20/pen/XaPqrR
-When I coded it locally, everything worked great, and the player actions were were done using jquery-based animations. (I used the setTimeout(), animation(), css(), and attr() a lot to move the avatars around and switch pictures to show movement
–The problem—
-I put the code on codepen, and so I needed to host the sprite images to use them (I used dropbox). This change caused the animations to not work properly. Some of the images and sounds either load slowly or not at all. If you go to the codepen and try the buttons at the bottom you will quickly see what I mean.
—What I tried—
-I thought that maybe this might be a problem with the app taking too long to load the assets and cache them. (because some of the animations became more fluid after I repeated them) So I added a function near the top to load the photos at the beginning ‘imageInit()’. But the problem persists.

Can anyone please help me figure out what is making my jquery animations so choppy and inconsistent? Am I using the wrong techniques perhaps? Please let me know if you need any more info about this.

Thank you!


1 Like

Why would imageInit preload them? You’re just printing the urls or setting one image to the last on the list.

1 Like

You’re right. I had a weak understanding of how preloading works, I did some further reading and now have figured out how to do it properly. Thank you for the nudge in the right direction!