[Help] I need help with melee combat
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
[Help] I need help with melee combat
How would I go about doing melee combat for a side scrolling sword fighting game, I want it so let's say if isAttacking = true, the enemy gets damaged how would I go about doing damage? An example code would also help greatly (I self teach myself a lot, looking at code is sort of how I learn!) Thanks in advance
Re: [Help] I need help with melee combat
Generally, you probably would play animations according to player/AI input, check for collision at the right time to detect hits, and update your game state accordingly.
You're asking very broad questions and the answers depend on a lot factors, what exactly you mean by "doing damage", and the game design goals in general. It would help if you could describe the parts you have problems with. If you don't even know where to start, I'd recommend reading a book or online articles about game design and programming.
You're asking very broad questions and the answers depend on a lot factors, what exactly you mean by "doing damage", and the game design goals in general. It would help if you could describe the parts you have problems with. If you don't even know where to start, I'd recommend reading a book or online articles about game design and programming.
Code: Select all
-- do damage
enemy.hitpoints = math.max(0, enemy.hitpoints - damage)
Who is online
Users browsing this forum: Bing [Bot] and 6 guests