• Register

A weird jellyfish handles marriage crisis with alcohol, drugs, sex, blows and lots of odd characters.

Post news Report RSS Real time pixel arms

In this article we will explain how we developed the pixelated arms of our main character.

Posted by on

When I posted the following tweet, many of you asked me how I manage to draw the arm of our character in real time. It is much simpler than it seems.


We start by drawing a segment.

What we have? 2 points, the beginning of the segment and the end, we also have the pixel size, which in our case we determine depending on the Sprite selected automatically.


The process is pretty simple, we calculate distances between the possible positions of our next pixel with the end point, the pixel that has the best distance to the final pixel will be the one chosen to be drawn. (this is very optimizable, for example, if the target pixel is in a lower position than our current pixel, we can directly discard the higher positions).


  • Possible position of the next pixel
  • Position of the next pixel
  • Segment

In an iterative task, our origin pixel is now the pixel already drawn, until the distance of the next pixel to be drawn is greater than the distance of the current pixel with the destination.

Not optimized version

Optimized version

Real-time Example

This process has to be repeated every frame.

We have almost all the work done, to have the complete arm we just have to position the elbow, this elbow will be the end of the first segment and the beginning of the second segment, which will move based on the position of the initial point of the first segment and the end point of the second segment.

Real-time Example

Ready, we have our fully functional arm , let's see it in action.




I hope you liked it.

We take this opportunity to say we are rith now on Kickstarter, if you have a moment you could take a look


For more information you can enter our Website or follow us on Twitter, thanks for reading our article!

Dan.

Comments
alanberserkrose
alanberserkrose

Interesting!

Reply Good karma Bad karma+4 votes
HungryPixel Author
HungryPixel

Thanks :)

Reply Good karma+4 votes
Guest
Guest

Nice solution, did you consider using the bresenham algorithm tough? :)

Reply Good karma Bad karma+2 votes
HungryPixel Author
HungryPixel

I considered using Dijkstra, but for such a simple case it was not necessary. :)

Reply Good karma+2 votes
gameartdevguy
gameartdevguy

Looks pretty cool guys! ^^

Reply Good karma Bad karma+3 votes
HungryPixel Author
HungryPixel

Thank you so much

Reply Good karma+2 votes
Guest
Guest

Удивительно

Reply Good karma Bad karma+1 vote
HungryPixel Author
HungryPixel

Hello mate, I don't speak Russian, but thanks.

PS I'm planning to travel to Russia, nice country.

Reply Good karma+1 vote
Guest
Guest

Nice!!

Reply Good karma Bad karma+1 vote
HungryPixel Author
HungryPixel

Thanks!

Reply Good karma+1 vote
Guest
Guest

Mind blowing.

Reply Good karma Bad karma+1 vote
HungryPixel Author
HungryPixel

Thank you!

Reply Good karma+1 vote
Post a comment
Sign in or join with:

Only registered members can share their thoughts. So come on! Join the community today (totally free - or sign in with your social account on the right) and join in the conversation.

Follow Report Profile
Icon
NetherWorld: Drugs, Sex and Pixels
Platforms
Windows, Mac, Linux, Switch
Creator
HungryPixel
Engine
Unity
Contact
Send Message
Release date
Game watch
Follow
Related Games
Related Engines
Unity
Unity Commercial
Related Groups
Indie Devs
Indie Devs Hobbies & Interests with 1,658 members
Indie Gamers
Indie Gamers Hobbies & Interests with 1,510 members
Indiegogo
Indiegogo Web & Community with 51 members
Kickstarter
Kickstarter Web & Community with 37 members
Unity Games
Unity Games Hobbies & Interests with 1,812 members
Unity3d Discussion
Unity3d Discussion Educational with 26 members