I need help with Hardon Collider...
Posted: Thu Jun 13, 2013 7:11 pm
Hi everyone,
I'm still working on my first game, I rewrote it from scratch as I think I'm beginning to getting how Lua and LÖVE are working.
Browsing the Wiki and the forum I come to the conclusion that using BoundingBox.lua for a screen full of enemies and bullets would not be the better, from a performance point of view.
So I decided to have a look at Hardon Collider. So far I could implement it without problem, all the shapes are providing a callback when there is a collision.
My problem is how to resolve the collision now. Let me explain, I'd like to manage several type of collisions:
I've just put a test in my function on_collide and I can see that the shape are colliding as they should. But now, how do I determine which shape collides with which shape?
So far I've been trying to do it by iterating all the tables one after the other and assigning to the shapes to temp ones to compare them... It's not working and I feel it's not the right way to do it.
If you look at the code, good luck, it's a bit of a mess at the moment as I was working on the interface more than everything and a lot of thing are not in place yet.
Thanks in advance.
I'm still working on my first game, I rewrote it from scratch as I think I'm beginning to getting how Lua and LÖVE are working.
Browsing the Wiki and the forum I come to the conclusion that using BoundingBox.lua for a screen full of enemies and bullets would not be the better, from a performance point of view.
So I decided to have a look at Hardon Collider. So far I could implement it without problem, all the shapes are providing a callback when there is a collision.
My problem is how to resolve the collision now. Let me explain, I'd like to manage several type of collisions:
- Player with enemy: will kill the player instantly, damage the enemy.
- Player with power-up: will power the player up, remove the power-up icon.
- Player with scenery: will kill the player, no effect on scenery.
- Player's bullets with enemy: will damage the enemy, remove the bullet.
- Enemy's bullet with player: will kill the player, remove the bullet.
- Enemy's bullet with scenery: will remove the bullet, no effect on scenery.
I've just put a test in my function on_collide and I can see that the shape are colliding as they should. But now, how do I determine which shape collides with which shape?
So far I've been trying to do it by iterating all the tables one after the other and assigning to the shapes to temp ones to compare them... It's not working and I feel it's not the right way to do it.
If you look at the code, good luck, it's a bit of a mess at the moment as I was working on the interface more than everything and a lot of thing are not in place yet.
Thanks in advance.