Can any one please help me with this bullet class, python?

Hi all. so i've been wanting to try out a side scroller type of game where there enemies and you have to kill them. i don't want to release this, i am just experimenting with this kind of things. so i am running into a little problem. I am using the facing of the player class to indicate wether the bullet should move right or left. Here is my problem:
When i am facing right, the bullet kind of moves to the right and hits the enemies. but when i am facing left, it is as if there are no bullets, and it does not make sence to me why not. I will paste the code below:
Please if any one can just point me in the right direction... sorry for if this looks stupid.
import lucia.utils.timer
import player
bullets=[]
class bullet:
    def __init__(self, maxx, speed, damage):
        self.maxx=maxx
        self.speed=speed
        self.bx=0
        self.firetimer=lucia.utils.timer.Timer()
        self.damage=damage
def spawn_bullet(maxx,speed,damage):
    bullets.append(bullet(maxx,speed,damage))

def bulletloop():
    for i in bullets:
        if i.firetimer.elapsed>=i.speed:
            i.firetimer.restart()
            if player.p.facing=="right":
                i.bx+=1
            elif player.p.facing=="left":
                i.bx-=1
        if i.bx>i.maxx:
            bullets.remove(i)

-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector

Reply via email to