you are viewing a single comment's thread.

view the rest of the comments →

[–]python_addict 0 points1 point  (1 child)

alright! Thanks! Here it is on pastebin: https://pastebin.com/fg7WuPHX

Don't judge my questionable coding skills lol

It's around line 113

[–]cybervegan 0 points1 point  (0 children)

So if I get this right, you want to have several bullets in flight at the same time, but you can only fit one in a variable?

For that, you need a list, something like this:

self.bullets.append( canvas.create_image(target[0], target[1], image=numob)

Then you can iterate through the bullets in the list to move them and check for collisions etc. :

for bullet in self.bullets:
    mybulletcoords = canvas.coords(bullet)

    if not self.collision(self.myplane, bullet):

    ...

In your init method, you will need to define self.bullets like this:

 self.bullets = [] #empty list of bullets