Skip to main content

#30daydeveloper - Day 5 - Flick!

Hello! If this is your first time reading about my thirty day developer challenge, click here to go to the first post!

Flick works! Hurray!

Ok, actually it doesn't work perfectly just yet. For the most part it works, except in the cases where I flick the mouse too quickly, then the behavior gets a bit wonky.

What I am doing is keeping a historical record of the past 100 milliseconds of the mouse locations on the screen while the mouse is pressed. Then I am finding the deltas of each two points and adding them together to create a velocity for the object. Then I assign that velocity to the object when the mouse button is released.

I was able to get the idea for the above method from this post. (Thank you Rich from Phaser forums!)

Unfortunately, the method isn't perfect. For example, let's say I move the mouse to the right 500 pixels and then move it quickly a 100 pixels to the left, then the object will still move to the right upon release because the way I calculated was to average up the last 100 milliseconds.

In other words, let's just say that if I've been moving to the right (positive x-axis, positive x-velocity) for four seconds, then switch at the last second to the left (negative x-axis, negative x-velocity) the four seconds of positive x-velocity will overshadow the last second of negative x-velocity. Thus the object will move to the right upon release, although it should move to the left because that's the direction it was travelling in last.

I am satisfied for today though. You can't climb an entire mountain in one day, you have to take it one small step at a time.


On a side note, feels good to get this far already!

Comments

Popular posts from this blog

Jooble

Yesterday, I received an incredibly friendly email from an anonymous person who claimed to have read my blog and "loved it." Of course, because my blog is public and anybody can comment anonymously, I was a bit skeptical of this email. Yet, seeing as how this was the first ever "fan mail" I've ever received, I read the email. It wasn't fan mail, but it was an email from a person who works for a website called " Jooble ." Interested by his genuineness and heartfelt compliments of my blog, I took a quick glance at the website. Here's what he had to say about Jooble: Jooble operates in 45+ countries, so if you would like to find a job in other locations you may try to search jobs in: Argentina , Australia , Austria , Belgium , Belarus , Brazil , Canada , Chile , China Colombia , Czech Republic , Denmark , Spain , Finland , France , Germany , Greece , Hong Kong , Hungary , Italy , India , Indonesia , Ireland , Japan , Kazakhstan , Mexi...

Making a Board Game

Wanted to update my blog with what I've been up to recently. I made a board game and have been working on that full time for the past 3 or so months. The name is still WIP but it's tentatively set as "Our Modern Lives." It's a tile/card based map-building game. The goal is to achieve "Success" and "Happiness" before anyone else can by building your own route. Here are a few pictures of the current build (v1.20 Beta): On a side note, follow me on Instagram for more (semi-frequent) updates!

#30daydeveloper - Day 1 - War of Shapes

Today marks the first day of a new experiment I am doing. Dubbed the "30 Day Developer" challenge. I am taking the next thirty days to try to fulfill my two new years resolutions . For the next thirty days, I will create a working prototype of an idea I had for a mobile game. Furthermore, I promise that I will... develop for at least an hour each day. blog about the day's events and any related events / thoughts. not give up! Mock up of "War of Shapes" (name pending finalization) The game is very simple (as I believe mobile games should be). Several colored balls drop from a chute onto the middle of the screen. The player then used his/her finger to swipe the colored ball into the matching colored corner. The game is meant to be played at an incredibly fast pace (think Super Hexagon ). I also envisioned techno-trance music roaring in the background as the user madly swipes at his/her phone. The game will be developed using the languages I am fam...