Help with Collisions/Hitbox [Solved]

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
Leumy
Prole
Posts: 2
Joined: Tue Jun 18, 2024 8:35 pm

Help with Collisions/Hitbox [Solved]

Post by Leumy »

Hi guys, I am new with LOVE2D and I seek your ancient knowledge. basically, I'm having a big difficult with the collision/hitboxes, specifically with the weapon hitbox.

So, the game I trying to make is an action platform (like a Castlevania), and in the combat system I want to make an arc-shaped collision, and make it appears in front of the player hitbox (like a sword swiping down) when the attack button is pressed, and when the button is released, make that collision disappears, I have no idea how I can do this.

Until now I am using the "Winfield" library to build all the physics, but if you guys know a better library, I'd like to experiment :)

Btw, English is not my first language, so sorry if I didn't made clear what I am trying to say.
Last edited by Leumy on Thu Jun 20, 2024 3:55 pm, edited 1 time in total.
User avatar
marclurr
Party member
Posts: 116
Joined: Fri Apr 22, 2022 9:25 am

Re: Help with Collisions/Hitbox

Post by marclurr »

There's no need to create a complicated collision shape. Just place an AABB roughly encompassing the extents of the slash animation for the amount of time it lasts. While it's active it can be tested against enemy AABBs to damage them. It will be so brief that the inaccuracy won't be noticeable and you can just tweak the dimensions until you're happy with how it looks.
User avatar
zorg
Party member
Posts: 3452
Joined: Thu Dec 13, 2012 2:55 pm
Location: Absurdistan, Hungary
Contact:

Re: Help with Collisions/Hitbox

Post by zorg »

Windfield you mean; also do stop using that since it's deprecated and unmaintained. Use love.physics if you must, but your game might not need such realistic physics in the first place.
Me and my stuff :3True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.
User avatar
togFox
Party member
Posts: 807
Joined: Sat Jan 30, 2021 9:46 am
Location: Brisbane, Oztralia

Re: Help with Collisions/Hitbox

Post by togFox »

> want to make an arc-shaped collision

Maybe "collision" is the wrong word? You can do an animation of a sword swing using a sprite sheet. The game I have in my sig is a sword fighting game that has a sword swing animation. Collision detection is probably not on the sword itself but the area the sword swings through.

If you really do need physics, which is unlikely, then love.physics is not that hard to use.
Last project:
https://togfox.itch.io/hwarang
A card game that brings sword fighting to life.
Current project:
Turn-based PBEM horse stable (racing) management sim: https://togfox.itch.io/horse-stable-manager
https://discord.gg/HeHgwE5nsZ
Leumy
Prole
Posts: 2
Joined: Tue Jun 18, 2024 8:35 pm

Re: Help with Collisions/Hitbox

Post by Leumy »

I studied more and implemented your advices, it worked! I think I was exaggerating in simple things and made it more difficult than it was. So, thank you guys, if any problem happens again,ni will come back :)
Post Reply

Who is online

Users browsing this forum: No registered users and 8 guests