Hello
I've finally made basic movement (I have stairs in my game \o/).
I started to think about spawning entities and stuff but it won't be that hard I belive.
The serious problem is concept of hitbox. I know how to check if rectangle is in another rectangle but I have no idea how to manage them.
How do I know which hitbox hit whatever it hits?
Do I check if player has been hit by a bullet or if bullet hit player?
Do I store hitboxes in another array and check them in every frame?
Will it be a little segment of code in every entity or huge hitbox system with Zordon inside?
I tried to find something usefull in google but I failed ; _ ;7
If anyone have some experience/opinion/concept/picture/idea about implementing hitboxes, please share <3
Starting with hitboxes
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
Re: Starting with hitboxes
I would suggest checking out Hardon Collider to manage this stuff for you. It's a cool little library for collision management.
Re: Starting with hitboxes
This quesiton would normally have one single straightforward solution, the one you see right in front of you.
Supposedly, you know in advance which hitboxes are you checking.
Player check all bullets or all bullets check player is the same thing, therefore it's irrelevant.
You can only check them when motion happens, if that matters. You can store hitboxes in your entities' tables.
Supposedly, you know in advance which hitboxes are you checking.
Player check all bullets or all bullets check player is the same thing, therefore it's irrelevant.
You can only check them when motion happens, if that matters. You can store hitboxes in your entities' tables.
- substitute541
- Party member
- Posts: 484
- Joined: Fri Aug 24, 2012 9:04 am
- Location: Southern Leyte, Visayas, Philippines
- Contact:
Re: Starting with hitboxes
I would suggest to post a link to Hardon Collider so he doesn't have to Google for it.Plu wrote:I would suggest checking out Hardon Collider to manage this stuff for you. It's a cool little library for collision management.
Currently designing themes for WordPress.
Sometimes lurks around the forum.
Sometimes lurks around the forum.
-
- Party member
- Posts: 235
- Joined: Sat Dec 15, 2012 6:54 am
Re: Starting with hitboxes
Also, bump.lua might be a useful, and simpler, alternative to HardonCollider:
https://love2d.org/wiki/bump.lua
https://love2d.org/wiki/bump.lua
Re: Starting with hitboxes
I'd rather write something on my own That way I won't be able to blame anyone else but myself
After some thinking and looking at these libraries it came out that I'm overthinking pretty hard
Basically I need to check if "bad" things are hiting player and if player is hiting anything. Kinda... ekhm, simple
But what should I do when I want to have delayed attack? Like in Castlevania - you must wait for the animation to reach certain point.
I'm not sure but I think there is no way to tell on which frame animation is currently on.
I'm using anim8.
Maybe there is some fancy trick or do I need to set timer for attack?
Something like:
0.8 second attack - searching for enemies to hit from 0.4
After some thinking and looking at these libraries it came out that I'm overthinking pretty hard
Basically I need to check if "bad" things are hiting player and if player is hiting anything. Kinda... ekhm, simple
But what should I do when I want to have delayed attack? Like in Castlevania - you must wait for the animation to reach certain point.
I'm not sure but I think there is no way to tell on which frame animation is currently on.
I'm using anim8.
Maybe there is some fancy trick or do I need to set timer for attack?
Something like:
0.8 second attack - searching for enemies to hit from 0.4
Who is online
Users browsing this forum: Ahrefs [Bot] and 4 guests