Adicionar modo debug

This commit is contained in:
Guilherme Aleixo de Oliveira Martins 2024-11-21 14:05:36 -03:00
parent 26645d8d0b
commit e2fb482e4e
1 changed files with 16 additions and 3 deletions

View File

@ -1,6 +1,16 @@
#setup #setup
import turtle as tl import turtle as tl
import random import random, sys
args = sys.argv
# name, -arguments
def has_argument(args, arg):
if len(args) > 1:
if args[1].startswith("-"):
for chr in args[1]:
if chr == arg:
return True
return False
posx = [0, 1, 2, 3, 4] posx = [0, 1, 2, 3, 4]
posy = [0, 1, 2, 3, 4] posy = [0, 1, 2, 3, 4]
@ -58,9 +68,12 @@ enemies = []
for i in range(AMOUNT_OF_ENEMIES): for i in range(AMOUNT_OF_ENEMIES):
enemy = tl.Turtle() enemy = tl.Turtle()
enemy.up()
enemy.hideturtle()
enemy.color("red") enemy.color("red")
enemy.up()
if not has_argument(args, "D"):
enemy.hideturtle()
else:
enemy.shapesize(3, 3)
pos = [random.choice(posy), random.choice(posy)] pos = [random.choice(posy), random.choice(posy)]
enemy.goto((pos[0] - 2) * 100, (pos[1] - 2) * 100) enemy.goto((pos[0] - 2) * 100, (pos[1] - 2) * 100)