Я делаю простую игру с луком и стрелами на Python, используя библиотеку черепах, и я хочу иметь возможность стрелять стрелой по команде и изменять ее начальную скорость и угол с помощью ввода с клавиатуры. Однако я не могу запустить стрелу по команде. Мой код такой:
Я делаю простую игру с луком и стрелами на Python, используя библиотеку черепах, и я хочу иметь возможность стрелять стрелой по команде и изменять ее начальную скорость и угол с помощью ввода с клавиатуры. Однако я не могу запустить стрелу по команде. Мой код такой: [code]import math import turtle import time import keyboard import pygame
#dibujar target target = turtle.Turtle() target.speed(0) #Velocidad de animacion, no de movimiento target.shape("circle") target.color("white") target.shapesize(stretch_wid = 3, stretch_len = 3) target.penup() ##Para que no trace línea de movimiento target.goto(350,0) ##posición inicial
target2 = turtle.Turtle() target2.speed(0) #Velocidad de animacion, no de movimiento target2.shape("circle") target2.color("red") target2.shapesize(stretch_wid = 2, stretch_len = 2) target2.penup() ##Para que no trace línea de movimiento target2.goto(350,0) ##posición inicial
target3 = turtle.Turtle() target3.speed(0) #Velocidad de animacion, no de movimiento target3.shape("circle") target3.color("white") target3.shapesize(stretch_wid = 1, stretch_len = 1) target3.penup() ##Para que no trace línea de movimiento target3.goto(350,0) ##posición inicial
target4 = turtle.Turtle() target4.speed(0) #Velocidad de animacion, no de movimiento target4.shape("circle") target4.color("red") target4.shapesize(stretch_wid = 0.5, stretch_len = 0.5) target4.penup() ##Para que no trace línea de movimiento target4.goto(350,0) ##posición inicial
#dibujar arco bow = turtle.Turtle() bow.speed(0) #Velocidad de animacion, no de movimiento bow.shape(turtle.circle(20,180)) bow.color("brown") bow.shapesize(stretch_wid = 5, stretch_len = 1) bow.penup() ##Para que no trace línea de movimiento bow.goto(-350,0) ##posición inicial
#dibujar flecha arrow = turtle.Turtle() arrow.speed(0) #Velocidad de animacion, no de movimiento arrow.shape("arrow") arrow.color("cyan") arrow.penup() ##Para que no trace línea de movimiento arrow.goto(-350,0) ##posición inicial