[Help] I need help with melee combat

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
jonthums
Prole
Posts: 1
Joined: Tue Sep 26, 2017 11:54 am

[Help] I need help with melee combat

Post by jonthums »

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 :D
grump
Party member
Posts: 947
Joined: Sat Jul 22, 2017 7:43 pm

Re: [Help] I need help with melee combat

Post by grump »

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.

Code: Select all

-- do damage
enemy.hitpoints = math.max(0, enemy.hitpoints - damage)
Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 6 guests