I have a HardonCollider problem

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
superdajk
Prole
Posts: 3
Joined: Tue Feb 21, 2012 7:58 pm
Location: The Netherlands

I have a HardonCollider problem

Post by superdajk »

Hey there,

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
Only the first weapon equipped appears to be responding with the zombie object.

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
Attachments
loveZeldaCB.love
(64.06 KiB) Downloaded 81 times
User avatar
Puzzlem00n
Party member
Posts: 171
Joined: Fri Apr 06, 2012 8:49 pm
Contact:

Re: I have a HardonCollider problem

Post by Puzzlem00n »

I'm not sure exactly what you mean by this, as I can't tell what's supposed to be happening in your example. What do you mean when you say "responds to the zombie object?" When I play, I can't tell if anything's happening with the first weapon, either.
I LÖVE, therefore I am.
Post Reply

Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 8 guests