1
respuesta

Mi solucion a la cara de Creeper

Posible Solución - Cara de Creeper

<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
    </head>
    <body>
        <canvas width="600" height="400"></canvas>

        <script lang="javascript">
            const pizarra = document.querySelector('canvas');
            const lapiz = pizarra.getContext('2d');

            // RECTANGULO 1 (Cabeza)
            lapiz.fillStyle = "darkgreen";
            lapiz.fillRect(0, 0, 350, 300);


            // RECTANGULO 2 (Ojo)
            // (left <-> right), (top <-> bottom), width, height
            lapiz.fillStyle = "black";
            lapiz.fillRect(50, 40, 90, 90); 


            // RECTANGULO 3 (Ojo)
            // (left <-> right), (top <-> bottom), width, height
            lapiz.fillStyle = "black";
            lapiz.fillRect(210, 40, 90, 90);


            // RECTANGULO 4 (Nariz)
            // (left <-> right), (top <-> bottom), width, height
            lapiz.fillStyle = "black";
            lapiz.fillRect(140, 130, 70, 100);


            // RECTANGULO 5 (Parte de la boca)
            // (left <-> right), (top <-> bottom), width, height
            lapiz.fillStyle = "black";
            lapiz.fillRect(100, 190, 40, 110);


             // RECTANGULO 6 (Parte de la boca)
            // (left <-> right), (top <-> bottom), width, height
            lapiz.fillStyle = "black";
            lapiz.fillRect(210, 190, 40, 110);
        </script>
    </body>
</html>

Saludos Atte. Daniel Gómez

1 respuesta

Hola Daniel! Espero que estés muy bien.

Gracias por compartir tu código con nosotros, lo probé aquí y funciona perfectamente!

Felicidades y no olvides que si tienes alguna duda sobre el contenido de los cursos, estaremos aquí para ayudarte! :)

Si este post te ayudó, por favor, marca como solucionado ✓. Continúa con tus estudios!