Skip to content

Latest commit

 

History

48 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Evidencia de proyecto

Alumnas:
Ana Itzel Hernández García A01737526
Paola Rojas Domínguez A01737136

Paint

Descripción

Dibuja líneas y formas en la pantalla. Haga clic para marcar el inicio de una forma y haga clic nuevamente para marcar su final. Se pueden seleccionar diferentes formas y colores mediante el teclado.

Cambios realizados

Se añadió el color rosa
onkey(lambda: color('pink'), 'P')

Se completo la función para diujar un círculo

def circle(start, end):
    """Draw circle from start to end."""
    up()
    goto(start.x, start.y)
    down()
    begin_fill()
    radius = abs(end - start) / 2
    circ = 2 * math.pi * radius
    step = circ / 360
    angle = 360
    while angle > 0:
        forward(step)
        left(1)
        angle -= 1
    end_fill()

Se completó la función para dibujar un rectángulo

def rectangle(start, end):
    """Draw rectangle from start to end."""
    up()
    goto(start.x, start.y)
    down()
    begin_fill()

    for count in range(2):
        forward(end.x - start.x)
        left(90)
        forward(end.y - start.y)
        left(90)

    end_fill()

Se completó la función para dibujar un triángulo

def triangle(start, end):
    """Draw triangle from start to end."""
    up()
    goto(start.x, start.y)
    down()
    begin_fill()

    # Length of the line segment between start and end
    length = math.sqrt((end.x - start.x)**2 + (end.y - start.y)**2)

    # Angle of the line segment
    angle = math.atan2(end.y - start.y, end.x - start.x)

    # Coordinates of the third vertex (assuming equilateral triangle)
    third_x = end.x + length * math.cos(angle + (2 * math.pi / 3))
    third_y = end.y + length * math.sin(angle + (2 * math.pi / 3))

    # Draw the triangle
    goto(end.x, end.y)
    goto(third_x, third_y)
    goto(start.x, start.y)

    end_fill()

Snake

Descripción

Clásico juego de arcade. Utilice las teclas de flecha para navegar y comer la comida. Cada vez que se consuma, la serpiente crece un segmento más. ¡Evita comerte o salirte de los límites!

Cambios realizados

La comida se mueve un espacio cada vez que la serpiente cambia de dirección
def change(x, y):
    """Change snake direction."""
    aim.x = x
    aim.y = y
    food.x = max(min(food.x + randrange(-1, 2) * 10, 190), -200)
    food.y = max(min(food.y + randrange(-1, 2) * 10, 190), -200)

La serpiente y la comida cambian de color cada vez que se inicia el juego

snake_color = choice(colors)
food_color = choice([color for color in colors if color!= snake_color])

Pacman

Descripción

Clásico juego de arcade. Usa las teclas de flecha para navegar y comer toda la comida blanca. Cuidado con los fantasmas rojos que deambulan por el laberinto.

Cambios realizados

Los fantasmas siguen de mejor forma a pacman
dist = abs(pacman - point)

        if dist < 100:
            course.x = aim.x
            course.y = aim.y

El tablero fue modificado

tiles = [
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0,
    0, 1, 0, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0,
    0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0,
    0, 1, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 1, 0, 0, 1, 0,
    0, 1, 1, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0,
    0, 1, 0, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0,
    0, 1, 0, 0, 1, 0, 1, 1, 1, 1, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0,
    0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0,
    0, 0, 0, 0, 1, 0, 1, 1, 1, 1, 1, 0, 1, 0, 0, 1, 0, 0, 1, 0,
    0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 1, 0, 0, 1, 0,
    0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 0,
    0, 1, 0, 0, 1, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0,
    0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 0, 1, 0,
    0, 0, 1, 0, 1, 0, 1, 0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0, 1, 0,
    0, 1, 1, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 1, 1, 0, 0, 1, 0,
    0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0,
    0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0,
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
]

Los fantasmas son más rápidos

for point, course in ghosts:
        if valid(point + course):
            point.move(course)
        else:
            options = [
                vector(10, 0),
                vector(-10, 0),
                vector(0, 10),
                vector(0, -10),
            ]
            plan = choice(options)
            course.x = plan.x
            course.y = plan.y

Cannon

Descripción

Movimiento de proyectiles. Haz clic en la pantalla para disparar tu bala de cañón. La bala de cañón hace estallar globos azules a su paso. Explota todos los globos antes de que puedan cruzar la pantalla.

Cambios realizados

La velocidad de la bala es mayor
def tap(x, y):
    """Respond to screen tap."""
    if not inside(ball):
        ball.x = -199
        ball.y = -199
        speed.x = (x + 200) / 5 
        speed.y = (y + 200) / 5

Los globos se mueven más rápido

def move():
    """Move ball and targets."""
    if randrange(40) == 0:
        y = randrange(-150, 150)
        target = vector(200, y)
        targets.append(target)

    for target in targets:
        target.x -= 5

El juego no tiene fin, los globos siguen apareciendo

Memory

Descripción

Juego de rompecabezas de pares de números. Haga clic en un mosaico para revelar un número. Haga coincidir dos números y las fichas desaparecerán para revelar una imagen.

Cambios realizados

Se añadió con contador de taps
def tap(x, y):
    """Update mark and hidden tiles based on tap."""
    global counter
    counter += 1
    spot = index(x, y)
    mark = state['mark']

    if mark is None or mark == spot or letters[mark] != letters[spot]:
        state['mark'] = spot
    else:
        hide[spot] = False
        hide[mark] = False
        state['mark'] = None

Los dígitos están centrados

if mark is not None and hide[mark]:
        x, y = xy(mark)
        up()
        goto(x + 10, y + 10)
        color('black')
        write(letters[mark], font=('Arial', 30, 'normal'))

Se notifica cuando se desbloquearon todos los cuadros

if not any(hide) and not state['won']:
        up()
        goto(-200, 100)
        color('red')
        write("Congratulations! You have found all the pairs", font=('Arial', 15, 'normal'))
        #state['won'] = True

Se usan letras en lugar de números

letters = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'Ñ', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'aa', 'bb', 'cc', 'dd', 'ee']  * 2

About

Actividad 1. Juego Pintando

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages