Weapon System

guizanchettguizanchett Member Posts: 24
edited November -1 in Working with GS (Mac)
Hi, I'm creating a game that uses swords and guns, but, how do I do to attach the sword or the gun to my character?

Thx

Comments

  • svnsvn Member Posts: 445
    For the gun, you'll need an image/animations of your character holding a gun. Same thing for the sword. Even if you DON'T have these graphics yet, you can already start. Just create a Game Integer attribute called Weapons, and set it to 1. Now, tell your actor that you can press (anybutton) to change attribute Weapons from 1 to 2, and vice versa. Now tell your actor that when "game.attribute.weapons"=1, change image to your actor with a gun. Copy the rule, but change the 'game.attribute.weapons" to 2, and change image to your actor with sword.
  • guizanchettguizanchett Member Posts: 24
    Yeah, but how do I do to make it to hit, like pass the sword through the enemy?
  • svnsvn Member Posts: 445
    Well, first of all, is it in a top-down perspective, or side-view, or what?
  • guizanchettguizanchett Member Posts: 24
    side view, it's a platform game!
  • SlickZeroSlickZero Houston, TexasMember, Sous Chef Posts: 2,870
    Whenever you press a button to swing at something, have an invisible actor offscreen, and interpolate its position to the x and y of the actor, and interpolate back offscreen when the button is released. You'll have to use offsets to get it positioned wherever the sword is when you swing. And have rules for damage, death etc in any other actor that is affected by sword damage when they collide with that invisible actor.
  • guizanchettguizanchett Member Posts: 24
    So I would have to stick a invisible actor in front of my enemy?
  • SlickZeroSlickZero Houston, TexasMember, Sous Chef Posts: 2,870
    No, it's depending on how the actor uses the sword. If it's a stabbing motion, you would use a rectangular actor that is sitting offscreen, and when you press whatever button that makes him stab (and I assume it has an animation for that sword attack) you'd interpolate that invisible actors position to the main actors x, and y position, but you will also have to use an offset to the x and y so the invisible actor is laying over the same place that the sword is when it is sticking out.

    That's one way to do it, you could also use magnitude when you press the button to attack, but that's too complicated for me to explain since I can barely do it half the time, and it sounds like you aren't ready for that just yet.
  • guizanchettguizanchett Member Posts: 24
    Thx, that applies to a hit that comes from above until the sword touches the ground?
Sign In or Register to comment.