Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8360809
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T11:33:17+00:00 2026-06-09T11:33:17+00:00

I’m looking for an easier way to repeat this process and make it so

  • 0

I’m looking for an easier way to repeat this process and make it so I don’t have to go through each part individually. Maybe I should store the parts in an object, and tell which other part it connects to.

I guess my question would have to be:
What would an easy way to make a skeletal system be?

var drawPlayer = function() {
    ctx.strokeStyle = '#FFF';
    ctx.lineWidth = 3;
    ctx.beginPath();
    //body
    var temp = p2c(player.bodyLength/2, player.body);
    ctx.moveTo(player.pos.x + temp[0], player.pos.y - temp[1]);
    ctx.lineTo(player.pos.x - temp[0], player.pos.y + temp[1]);
    var humorusAnchor = [player.pos.x + temp[0], player.pos.y - temp[1]];
    var thighAnchor = [player.pos.x - temp[0], player.pos.y + temp[1]];
    //left humorus
    var temp = p2c(player.arms.humorusLength, player.arms.leftHumorus);
    ctx.moveTo(humorusAnchor[0], humorusAnchor[1]);
    ctx.lineTo(humorusAnchor[0] - temp[0], humorusAnchor[1] + temp[1]);
    var leftForearmAnchor = [humorusAnchor[0] - temp[0], humorusAnchor[1] + temp[1]];
    //right humorus
    var temp = p2c(player.arms.humorusLength, player.arms.rightHumorus);
    ctx.moveTo(humorusAnchor[0], humorusAnchor[1]);
    ctx.lineTo(humorusAnchor[0] - temp[0], humorusAnchor[1] + temp[1]);
    var rightForearmAnchor = [humorusAnchor[0] - temp[0], humorusAnchor[1] + temp[1]];
    //left forearm
    var temp = p2c(player.arms.forearmLength, player.arms.leftForearm);
    ctx.moveTo(leftForearmAnchor[0], leftForearmAnchor[1]);
    ctx.lineTo(leftForearmAnchor[0] - temp[0], leftForearmAnchor[1] + temp[1]);
    //right forearm
    var temp = p2c(player.arms.forearmLength, player.arms.rightForearm);
    ctx.moveTo(rightForearmAnchor[0], rightForearmAnchor[1]);
    ctx.lineTo(rightForearmAnchor[0] - temp[0], rightForearmAnchor[1] + temp[1]);
    //left thigh
    var temp = p2c(player.legs.thighLength, player.legs.leftThigh);
    ctx.moveTo(thighAnchor[0], thighAnchor[1]);
    ctx.lineTo(thighAnchor[0] - temp[0], thighAnchor[1] + temp[1]);
    var leftCalveAnchor = [thighAnchor[0] - temp[0], thighAnchor[1] + temp[1]];
    //right thigh
    var temp = p2c(player.legs.thighLength, player.legs.rightThigh);
    ctx.moveTo(thighAnchor[0], thighAnchor[1]);
    ctx.lineTo(thighAnchor[0] - temp[0], thighAnchor[1] + temp[1]);
    var rightCalveAnchor = [thighAnchor[0] - temp[0], thighAnchor[1] + temp[1]];
    //left calve
    var temp = p2c(player.legs.calveLength, player.legs.leftCalve);
    ctx.moveTo(leftCalveAnchor[0], leftCalveAnchor[1]);
    ctx.lineTo(leftCalveAnchor[0] - temp[0], leftCalveAnchor[1] + temp[1]);
    //right calve
    var temp = p2c(player.legs.calveLength, player.legs.rightCalve);
    ctx.moveTo(rightCalveAnchor[0], rightCalveAnchor[1]);
    ctx.lineTo(rightCalveAnchor[0] - temp[0], rightCalveAnchor[1] + temp[1]);
    ctx.stroke();
};
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T11:33:18+00:00Added an answer on June 9, 2026 at 11:33 am

    Basically you will have an array of joints or bones like so

    class Bone {
        Bone parent;
        Vector tail; // Translation from the parent node's tail
        public:
            Bone(Vector tail, Bone parent);
    };
    

    Then you have the body defined like so

    Bone bones[] = /* Array sizing */
    Bone root = Bone(Vector(0,0), null); // I think this is called the rhomboid, Not sure, area between the shoulders
    Bone leftShoulder = Bone(Vector(-10,0), root);
    Bone rightShoulder= Bone(Vector(10,0), root);
    Bone leftElbow = Bone(Vector(-10, 0), leftShoulder);
    Bone rightElbow = Bone(Vector(10,0), rightShoulder);
    // and so on...
    bones = [root, leftShoulder, rightShoulder, ...];
    

    And then to draw it, you would do this:

    foreach(bone in bones){
        Vector offset = bone.tail;
        Bone p = bone.parent;
        while(p.parent != null){ p = p.parent;offset+=bone.tail; }
        Vector parentOffset = offset - bone.tail;
        drawBone(offset, parentOffset);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I have a jquery bug and I've been looking for hours now, I can't
this is what i have right now Drawing an RSS feed into the php,
I have this code to decode numeric html entities to the UTF8 equivalent character.
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
I have thousands of HTML files to process using Groovy/Java and I need to
I have some data like this: 1 2 3 4 5 9 2 6
I am trying to loop through a bunch of documents I have to put
I don't have much knowledge about the IPv6 protocol, so sorry if the question

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.