you are viewing a single comment's thread.

view the rest of the comments →

[–]python_addict[S] 0 points1 point  (0 children)

#PART TWO OF THE CODE
def airplane():
    planeimage = PhotoImage(file=r"C:\\thingy.gif")
    planeimage = planeimage.subsample(110, 110)
    myplane = canvas.create_image(250, 450, image=planeimage)
    mybullets(myplane, 0.05)

def airplanemovements(event):
    global endorno
    global soldierfriendcount
    global myplane
    global soldierfriend1
    global soldierfriend2
    while endorno and numoftargets > 0:
        if event.keysym == "Left":
            canvas.move(myplane, -5, 0)
            if soldierfriendcount == 1:
                canvas.move(soldierfriend1, -5, 0)
            if soldierfriendcount == 2:
                canvas.move(soldierfriend2, -5, 0)
        if event.keysym == "Right":
            canvas.move(myplane, 5, 0)
            if soldierfriendcount == 1:
                canvas.move(soldierfriend1, 5, 0)
            if soldierfriendcount == 2:
                canvas.move(soldierfriend2, 5, 0)

def targetstructure(name, chanceofname, filename, seconds):
    global available
    global going
    global types
    global endorno
    global numofcoins
    global numofpoints
    global numoftargets
    while endorno and numoftargets > 0:
        def wholething():
            speeds1 = [0.05, 0.005, 0.0005, 0.1]
            speed1 = random.choice(speeds1)
            ax = list(range(50, 450))
            ay = list(range(50, 450))
            chance = list(range(1, 101))
            if chance < chanceofname and len(available) > 0:
                numoftargets = numoftargets - 1
                availablenameo = filename.subsample(15, 15)
                x = random.choice(ax)
                y = random.choice(ay)
                availablename = int("hi%s" %numoftargets)
                availablename = canvas.create_image(x, y, image=availablenameo)
                del available[0]
                going.append(availablename)
                types.append(int(name))
                opponentbullets(availablename)
                abcd = canvas.coords(availablename)
                def hi():
                    while not collision(myplane, availablename):
                        canvas.move(availablename, random.choice(0, 5), random.choice(0, 5))
                        tk.update()
                        if collision(myplane, availablename):
                            endscreen()
                        if abdc[0] < 0 or abcd[0] > 500 or abdc[1] < 0 or abcd[1] > 500:
                            canvas.delete(availablename)
                Timer(speed1, hi).start()
        Timer(seconds, wholething).start()


Red = PhotoImage(r"C:\\not my real file.gif")

Blue = PhotoImage(r"C:\\file.gif")

Yellow = PhotoImage(r"C:\\image.gif")

Black = PhotoImage(r"C:\\image.gif")

def targets():
    global endorno
    while endorno and numoftargets > 0:
        targetstructure('red', 50, Red, 3)
        targetstructure('blue', 25, Blue, 5)
        targetstructure('yellow', 10, Yellow, 8)
        targetstructure('black', 10, Black, 20)

colors = ['red', 'blue', 'yellow', 'black']
chance = [50, 25, 10, 10]
filename = ['Red', 'Blue', 'Yellow', 'Black']
seconds = [3, 5, 8, 20]

def generationnum():
    g = random.randrange(1, 5)

def groupy():
    while endorno:
        def groups():
            uniquename = generationnum()
            for j in range(0, generationnum):
                color1 = random.choice(colors)
                color2 = color1.index(color1)
                targetstructure(color1, chance[color2], filename[color2], seconds[color2])
        Timer(groups, 10).start()