Here's what I've got:
def checkhit():
global bullets
for i in bullets:
xhit = intersectx(i,enemies)
if xhit > 0:
yhit = intersecty(i,enemies)
if xhit == yhit:
print "HIT"
def intersectx(bullet,obj):
for i in range(bullet.xboundmin,bullet.xboundmax):
for ii in obj:
if i >= ii.xboundmin and i <= ii.xboundmax:
return ii
return 0
def intersecty(bullet,obj):
for i in range(bullet.yboundmin,bullet.yboundmax):
for ii in obj:
if i >= ii.yboundmin and i <= ii.yboundmax:
return ii
return 0
My problem are the return ii lines. What I need is to return the index of the object, but ii is the object itself. Is there a way to get that number at all?
This post has been edited by Ntwiles: 10 January 2011 - 08:17 PM

New Topic/Question
Reply




MultiQuote




|