Help with making melee weapons
Hi guys, I need help with making melee weapons:
I am making a top-down zombie survival game and I need to be able to make multiple weapons (melee) that each have different damage and range. If possible i want to be able to pick them up (Can only equip one at a time)from the ground.
Re: Help with making melee weapons
There are several ways to do this:
Here are two different approaches
1: Integrate the weapon in the character animation.
This aproach is not one I recommend, but I mention it anyway.
Make a new animation in the player character for each weapon.
They could be called:
- Walk with fork
- Walk with knife
- Stab with fork
- Stab with knife
If you have many weapons, this could be a bad approach as you will have to draw alot of different animations and if you ever want to change your character, this will be a timeconsuming process.
2: Use active objects for the weapons
This is my favorite apporach as it is easy and fast to add new weapons once you have the code ready.
Make each weapon an active object or have one active object that have animations for each weapon.
Always position the weapon at [0,0] from the player.
Always set the angle of the weapon to the angle of the player. You can use the Clickteam Movement Controller object to convert a direction to an angle. My favorite apporach is to have your player using angles and not actual animation directions and then simply give the weapon the same angle as the player.
Make the weapon in the same direction slot as the player.
If you are using the RIGHT -> direction slot, and the weapon is 50 pixels wide, make some space at the left of the weapon, and place the hotspot at left center. This is the point the weapon will rotate around.
Events for switching weapons
Regardless if you use approach 1 or 2, you can use a counter or a global value or string to control which weapon is active.
Since your player will only have one weapon, when he picks up the weapon, you could set the Global Value A to "Dagger".
Then you will test for what Global Value A is. If it is "Dagger", make the Dagger object visible, or turn on the Dagger animation, depending on the method you use.
I hope this gave you an idea of how to do it.
Re: Help with making melee weapons
Thanks, I'll try that out as soon as I can!
Re: Help with making melee weapons
Sorry for the double post.
Ok so I tried your suggestions, but i dont hav much experience with TGF so I could get neither to work. I was wondering if I could attach my game (unfinished) so you could add it in?
Only if you have the time.
Thanks
Re: Help with making melee weapons
We aren't going to make your game for you.
Re: Help with making melee weapons
Im sorry it came out wrong. I don't want you guys to make my game for me (though it would be nice!). I just need help with setting up the gameplay aspects, which is not the majority of the game (though it is important obviously). I definately dont have enough experience with this program or enough time (I'm studying for exams etc) and to be honest, all I get is a headache when i try to figure it out for myself! :p
So please can you guys consider helping me, and it is fine if you say no; Im sure ill find some other way.
Thanks, Oli.
Re: Help with making melee weapons
Ohoo, did this tutorial work also for MMF2 guys?
It appear yes, but i want have the confirmation (for not be stuck in development)
Re: Help with making melee weapons
Yes, as MMF2 is TGF2's superior, pretty much everything that can be done in TGF2 can be done in MMF2.
Re: Help with making melee weapons
Genial, thanks for quick answering me.
Re: Help with making melee weapons
Quote:
Originally Posted by RickyRombo
pretty much everything that can be done in TGF2 can be done in MMF2.
You mean everything, not pretty much everything. They're both exactly the same program - TGF2 just has lots of features not included.
Re: Help with making melee weapons
Sorry for replying to an old thread, but I have some problems with melee weapons as well..
I've searched high and low, but I can't seem to find any good tutorials or info how to make a melee weapon. I also draw the weapon (sword in this case) to the sprite itself, so it's even more difficult now. Whenever I hit something in the game, my character also takes damage and that's obviously not how it's supposed to be.
Any ideas how to fix this?
Re: Help with making melee weapons
Make sure you add events to check which animation is playing (sword or other) to determine when health is lost or damage is inflicted.
Re: Help with making melee weapons
I'm ashamed to admit, but I don't think I get it.
I made "animation Attacking is playing" event and I inserted "Collision between PLAYER and ENEMY" to it and then I made it destroy the enemy. So now when I hit, the enemy gets destroyed, but I still take damage. I'm basicly at the square one again, though this is much simpler method than what I used earlier.
I tried to make the Attacking animation invincible so that I wouldn't get hit when I attack, but I have no idea how I'm supposed to do that... I have to do something with the values, or?
Re: Help with making melee weapons
Well you have that part right, but you need to add the condition to your damage-taking event and negate it. To negate a condition, right click it and choose negate. That way you will only take damage if the animation is NOT playing. ;)
Re: Help with making melee weapons
Wow! That really helped a lot. I can finally progress in this project.
Thanks for the quick replies and I hope I wasn't too much of an inconvenience!