Real time pixel arms
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 about to launch our Kickstarter (probably when you read this has already been released) for more information you can enter our Website or follow us on Twitter, thanks for reading our article!
Dan.
NetherWorld
Status | In development |
Author | NetherWorld |
Genre | Adventure |
Tags | Action-Adventure, drugs, Gore, Pixel Art, sex, Story Rich, Tentacles |
More posts
- Netherworld July Devblog 2020Jul 29, 2020
- NetherWorld April Devblog 2020Apr 08, 2020
- NetherWorld June DevblogJun 10, 2019
- NetherWorld Pixel Bloodstain SystemMar 26, 2019
- NETHERWORLD DECEMBER DEVBLOGDec 14, 2018
- NetherWorld April-May DevblogMay 28, 2018
- NetherWorld graphic breakdownMar 18, 2018
- NetherWorld is on Kickstarter!Feb 21, 2018
- The protagonist of NetherWorld asks for helpJan 23, 2018
Comments
Log in with itch.io to leave a comment.
awesome!!!
Thanks :)