Sword as separate actor?

Hi, I'm in the process of making a game about a Ninja, who uses a sword.
Since I'm planning on having several different swords to choose from (Probably purely cosmetic), would it be possible to have the sword as it's own actor, so I don't need hundreds of frames of animation with each of the different swords?
And have the sword move at the same time as the hands in the main actor (The Ninja) so it looks like he's holding it?

Thanks in advance.

Comments

  • -Timo--Timo- Member Posts: 2,313
    it is possible but I think its hard because he is also using it to attack
    but you will need to constrain the sword his position to the ninja
  • VGXVGX Member Posts: 796
    Just search the word "constrain" here on the forums and you will gets tons of different answers. You might find the one that works for you.
  • MattcusMattcus Member Posts: 85
    I would constrain it, however the Ninja doesn't move, it's only an animation of him moving, so I don't really have anything for the sword to constrain to.
  • -Timo--Timo- Member Posts: 2,313
    thats why its hard... I also think your ninja has an attack animation and its hard to constrain the sword to his hand however the hand is moving/rotating (in animation)
  • FallacyStudiosFallacyStudios Member Posts: 970
    edited July 2013
    @Mattcus

    Yea I honestly don't know that it will constrain alone will properly work since it isn't like you can constrain it to a joint.

    What I would do is take each sword and create the animation for the sword so it is the same number frames as your ninjas attack. This way you can set both his attack animation and the swords animation to the same FPS which should give you little if any delay and look smooth. Although I haven't tried this, I would probably make each sword image the exact same size as the ninja images. So for example if you were in photoshop you would put your sword on the ninja image and make the ninja not visible. You may however have to leave a hand on the handle.

    Now you would constrain the sword actor to the same X and Y as your ninja. Now all you have to do is the same thing with each sword and just put in a Switch for whichever sword is equipped.

    The nice thing is you don't necessarily have to have to have the image as the same size as your ninja all the time. For example, if you had a larger than normal sword you would just make sure to extend the bounding box behind your ninja as well to accommodate for the extra distance for the sword on the front.

    With a little tweaking you could do the same thing with a smaller sword image size if you wanted to cut out excess bounding box. You will just have to constrain it to your ninja to accommodate the differences (Constrain NinjaX+40 etc). It will just take a tad more tweaking is all, but something like that should get you on the right track.
  • joshiwujoshiwu Member Posts: 207
    I actually just made a sidescrolling platform with an actor for the gun and for a sword as well. I like the look of a character with stuff strapped to his back. you need to register Player x and y to game level attributes and also the direction the player is facing need to be logged to an inerger (in degrees preferably as direction[rotation] is measured indegrees)
    then move your anchor on your sword, and use orbit or rotate+move. the problem you will run into Is calculating the delay In time that it take to put the sword up and take it out.
    P.s.you will need two rules one for if facing left one for if facing right. (or else the sword with be stuck in the samee position as you turn) or 8 rules if playing a top down game. just keep doing else if.

    p.p.s. also the sword image should change from just a sword to a sword with an arm grabing it when slicing. at which time your gun holding arm needs to disappear. If the character does not hold a weapon while running. Just have two animations of running one with the arm , one without.
  • joshiwujoshiwu Member Posts: 207
    also there is detailed instructions tshirtbooth put on youtube called "orbiting "
  • joshiwujoshiwu Member Posts: 207
    @mattcus email me if you have any questions as i have just done this. I could even sent you a template of my game if you need,
  • MattcusMattcus Member Posts: 85
    A template would be really useful! Could you send me one?
Sign In or Register to comment.