I'm having a problem with the HardonCollider collision library. I'm currently working on a Super Crate Box kind of game, but with 2D Zelda gameplay, to practice and improve my still amateur programming. In the game, you pick up crates which give you a new weapon every time (you discard your previous one) but they also increase your score. I've made it so that when you pick up a crate your new weapon is put in a table, together with a few of your previous weapons. This way I can do some fun stuff later with the discarded weapons. I'm using middleclass for OOP.
I can successfully refer to the current equipped weapon with player.weapon.equip[#player.weapon.equip] (such as player.weapon.equip[#player.weapon.equip]:fire(), or something).
As I said, I am working with HardonCollider. I'm doing my collision stuff with the on_collide callback, which worked fine for everything I threw at it. For some reason though, when I try something like:
Code: Select all
if shape_a == player.weapon.equip[#player.weapon.equip].cBox and shape_b == zombie.cBox then
print("Zombie hit by " .. tostring(player.weapon.equip[#player.weapon.equip]))
end
I can't figure out what is going wrong. If somebody could help me, I would be very grateful! I've attached the .love file.
Cheers