Sample HTML CODE: Computer Science 2 Lesson - 21 // Create the sprites var mushroom = createSprite(450, 325); mushroom.setAnimation("mushroom"); mushroom.velocityX = -5; var frog = createSprite(175, 325); frog.setAnimation("frog"); var fly = createSprite(475, randomNumber(50, 350)); fly.setAnimation("fly"); fly.velocityX = -7; //create the variables var score = 0; var health = 100; function draw() { // create the background background("skyblue"); noStroke(); fill("white"); ellipse(50, 50, 300, 50); ellipse(50, 50, 275, 50); ellipse(50, 50, 300, 75); ellipse(50, 50, 300, 25); fill("burlywood"); ellipse(100, 400, 300, 100); ellipse(300, 400, 300, 100); // if the frog touches the mushroom // the health goes down, and the mushroom turns if (frog.isTouching(mushroom)) { mushroom.rotation = 30; frog.velocityX = 0; health = health - 1; } else { mushroom.rotation = 0; } // if the frog touches the fly // the score goes up, the fly resets if (frog.isTouching(fly)) { fly.x = randomNumber(420, 480); fly.y = randomNumber(50, 350); score = score + 1; } // if frog is on ground, // jump if user presses up arrow, otherwise stop. if (frog.y >324) { if(keyWentDown("up")){ frog.velocityY = -5; } else { frog.velocityY = 0; } } // if the frog reaches the top of the jump // go back down if (frog.y < 150) { frog.velocityY = 5; } // if the mushroom has gone off the left hand side of the screen, // move it to the right hand side of the screen if (mushroom.x < -30) { mushroom.x = 430; } // if the fly has gone off the left hand side of the screen, // move it to the right hand side of the screen if (fly.x < -30) { fly.x = randomNumber(420, 480); fly.y = randomNumber(50, 350); } // display scoreboard fill("black"); textSize(20); text("Score:", 30, 30); text(score, 100, 30); text("Health:", 280, 30); text (health, 350, 30); drawSprites(); // if health runs out // show Game over if (health < 0) { background("black"); fill("green"); textSize(50); text("Game Over!" , 40, 200); } } Computer Science 1 <!DOCTYPE html> <html> <head> <link rel="stylesheet" href="style.css"> </head> <body> <h1> My Great Website </h1> <h2 class="mrh">Mr. Hjortsberg</h2> <h2> Pictures of Dogs </h2> <img src="Nine_Dogs.jpg" alt="9 dogs"> <p> this is for the citation...</p> <img src="4_puppies.jpg" alt="4 dogs"> <p> this is for the citation...</p> <h2> Name....</h2> <p> My name is .... and I am .... I like to ..... I go to.....</p> <hr> <hr> <h2> My Top Places to go</h2> <br> <ul> <li> Item 1</li> <li> Item 2</li> <li> NC......</li> <li> FL......</li> <li> NYC......</li> </ul> <h2> My Top Sports</h2> <ol> <li> Item 1</li> <li> Item 2</li> <li> Golf</li> <li> Basketball</li> <li> Sking</li> </ol> <h2> My Goals:</h2> <p> My goals are......</p> <h2> My Achievements:</h2> <p> My achievements are......</p> </body> </html> Sample CSS CODE: Body{ background-color: gray; text-align: center; Color: yellow; } .mrh{ color:red; font-size: 26px; } h1{ color: Red; Font-size: 55px; text-align: center; border-style:dotted; border-radius: 100px; border-color: yellow; border-width: 25px; background-color: lightyellow; font-family: cursive; } H2{ color: Green; Font-size: 66px; text-align: center; border-style: double; border-radius: 20px; border-color: Blue; border-width: 5px; background-color: lightgray; } p{ font-family: monospace; } } ul{ font-family: monospace; Font-size: 26px; text-align: left; } ol{ font-family: monospace; Font-size: 26px; } img{ height:350px; width: 350px; border-style: double; border-radius: 200px; border-color: yellow; border-width: 25px; } Computer Science 2 Unit 3 Lesson 15 Bubble 6 if(keyDown("left")){ flyer.x += -1; } else if (keyDown("right")){ flyer.x += 1; } else if (keyDown("up")){ flyer.y += -1; } else if (keyDown("down")){ flyer.y += 1; Lesson 8 4B: World.frameRate = 6; background("darkseagreen"); shape(150,0,250,0,250,130,400,-20,400,-15,400,121,250,271,250,400,150,400,150,250,0,250,0,150,150,150); line(200, 0, 200, 150); line(0, 200, 150, 200); line(200, 286, 200, 400); line(250, 200, 400, 55); var carTop = createSprite(225, 0); carTop.setAnimation("car_green"); carTop.scale = 0.6; carTop.rotation = 0; carTop.x = 225; var carTop2 = createSprite(173, randomNumber(0, 160)); carTop2.setAnimation("car_red"); carTop2.scale = 0.6; carTop.rotation = 180; drawSprites(); function draw(){ background("darkseagreen"); shape(150,0,250,0,250,130,400,-20,400,-15,400,121,250,271,250,400,150,400,150,250,0,250,0,150,150,150); stroke("yellow"); line(200, 0, 200, 150); line(0, 200, 150, 200); line(200, 286, 200, 400); line(250, 200, 400, 55); carTop.y = randomNumber(0, 160); carTop2.y = randomNumber(0, 160); carLeft.x = randomNumber(0, 160); carLeft2.x = randomNumber(0, 160); carBottom.y = randomNumber(400, 220); carBottom2.y = randomNumber(400, 200); drawSprites(); } CLUB CODE 10/10/2022 import random num = random.randint(1, 100) print("Please guess a number from 1 to 100...") while True: guess = int(input("Enter your guess: ")) if guess == num: print("Congrats! You got it right!") break else: if num > guess: print("You need to guess higher...") elif num < guess: print("You need to guess lower...") |
|