I Created Game in MS Paint!

Ғылым және технология

Making Game in MS Paint! & Python :v

Пікірлер: 8

  • @PracticalCoding.
    @PracticalCoding.9 күн бұрын

    Code: import pyautogui as pg import time, keyboard, random, sys width = 1100 height = 700 xpos = 450 ypos = 240 margin = 1 game_points = 0 def round_list(lista): rounded_list = [] for x, y in lista: round_x = round(x, -1) round_y = round(y, -1) rounded_list.append((round_x, round_y)) return rounded_list def round_point(point): return tuple(round(value, -1) for value in point) def move(X, Y): if keyboard.is_pressed('s'): pg.click(X, Y, button='right') Y += 7 pg.click(X, Y) if keyboard.is_pressed('w'): pg.click(X, Y, button='right') Y -= 7 pg.click(X, Y) if keyboard.is_pressed('d'): pg.click(X, Y, button='right') X += 7 pg.click(X, Y) if keyboard.is_pressed('a'): pg.click(X, Y, button='right') X -= 7 pg.click(X, Y) def generate(x, y, multiply, margin): global points points = [] for i in range(multiply): point_x = random.randint(x, 1550) point_y = random.randint(y, 900) pg.click(point_x, point_y) for i in range(margin): point_1m = (point_x-i, point_y+i) point_2m = (point_x+i, point_y-i) points.append(point_1m) points.append(point_2m) i += 1 print(points) #generate(xpos, ypos, 10, margin) # #pg.hotkey('win', 'r') #pg.write('mspaint') #pg.press('enter') time.sleep(3) pg.moveTo(xpos, ypos) pg.click() pg.dragRel(width, 0) pg.dragRel(0, height) pg.dragRel(-width, 0) pg.dragRel(0, -height) pg.mouseUp() time.sleep(1) generate(xpos, ypos, 100, margin) print(round_list(points)) pg.moveTo(960, 61) pg.click() time.sleep(1) pg.click(1008, 585) #print(pg.position()) while not keyboard.is_pressed('q'): x, y = pg.position() move(x, y) coords = x, y #print(coords) #print(round_list(points)) #print(coords) rounded_coords = round_point(coords) tolerance = 5 for point in points.copy(): if abs(point[0] - rounded_coords[0])

  • @angpang1637
    @angpang16378 күн бұрын

    The only ones are tic tac toe

  • @littleharry7977
    @littleharry79779 күн бұрын

    This is the best paint game I’ve seen ever

  • @PracticalCoding.

    @PracticalCoding.

    9 күн бұрын

    bro there are not many paint games maybe that's why

  • @DazaiUchiha101
    @DazaiUchiha1019 күн бұрын

    bro u editing is fire

  • @PracticalCoding.

    @PracticalCoding.

    9 күн бұрын

    bro 2 minutes of editing takes me 5 hours

  • @Gnume47
    @Gnume4710 күн бұрын

    dobry odcinek

  • @PracticalCoding.

    @PracticalCoding.

    10 күн бұрын

    dzięki

Келесі