Day 18 – Fly Swatter

Flies! Flies everywhere! This is what happens when coding goes wrong…

FliesAs someone who is afraid of repeating patterns, this was… kind of disturbing. But, I pushed on! Flies were appended to the sandwich div container one by one. I used random number generating functions to make them move within the container. One problem with my approach was that all the flies would end up moving at the same time, which makes their movement slightly robotic… but I find it kind of therapeutic to watch at the same time.

A fly would be removed when clicked on, but the number of flies would always keep adding up to 5. If 5 flies were appended, then the game was over. I guess I made an unbeatable game since there’s no end to the flies! Oops. I did add a fly counter for a small show of achievement…
fly
A funny side note: my sister complained about this page saying “I’m a competitive MOBA player and I’m clicking the fly so many times and it doesn’t register.” I think it may have been because I set it as a click event. I changed the event to a mousedown event in response!

Day 18 – Fly Swatter

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s