diff --git a/lib/tasks/project_components/dont-collide-starter/main.py b/lib/tasks/project_components/dont-collide-starter/main.py new file mode 100644 index 000000000..2856d8e41 --- /dev/null +++ b/lib/tasks/project_components/dont-collide-starter/main.py @@ -0,0 +1,18 @@ +#!/bin/python3 + +from p5 import * +from random import randint, seed + +# Include global variables here + + +def setup(): +# Put code to run once here + + +def draw(): +# Put code to run every frame here + + +# Keep this to run your code +run() diff --git a/lib/tasks/project_components/dont-collide-starter/project_config.yml b/lib/tasks/project_components/dont-collide-starter/project_config.yml new file mode 100644 index 000000000..b1b634032 --- /dev/null +++ b/lib/tasks/project_components/dont-collide-starter/project_config.yml @@ -0,0 +1,8 @@ +NAME: "Don't Collide!" +IDENTIFIER: "dont-collide-starter" +COMPONENTS: + - name: "main" + extension: "py" + location: "main.py" + index: 0 + default: true diff --git a/lib/tasks/project_components/dont_collide_avoid_germs_example/main.py b/lib/tasks/project_components/dont_collide_avoid_germs_example/main.py new file mode 100644 index 000000000..c9b0f10c0 --- /dev/null +++ b/lib/tasks/project_components/dont_collide_avoid_germs_example/main.py @@ -0,0 +1,122 @@ +#!/bin/python3 + +from p5 import * +from random import randint, seed + +level = 1 +score = 0 + +def safe_player(): + + global player_y + + # Face + fill(200, 134, 145) + ellipse(mouse_x, player_y, 60, 60) + + # Eyes + fill(178, 200, 145) + ellipse(mouse_x - 10, player_y - 10, 20, 20) + ellipse(mouse_x + 10, player_y - 10, 20, 20) + fill(0) + ellipse(mouse_x - 10, player_y - 10, 10, 10) + ellipse(mouse_x + 10, player_y - 10, 10, 10) + fill(255) + ellipse(mouse_x - 12, player_y - 12, 5, 5) + ellipse(mouse_x + 12, player_y - 12, 5, 5) + + # Mouth + fill(0) + ellipse(mouse_x, player_y + 10, 15, 10) + fill(200, 134, 145) + ellipse(mouse_x, player_y + 5, 10, 10) + +def crashed_player(): + + global player_y + + # Face + fill(178, 200, 145) + ellipse(mouse_x, player_y, 60, 60) + + # Eyes + fill(149, 161, 195) + ellipse(mouse_x - 10, player_y - 10, 20, 20) + ellipse(mouse_x + 10, player_y - 10, 20, 20) + fill(0) + ellipse(mouse_x - 10, player_y - 10, 10, 10) + ellipse(mouse_x + 10, player_y - 10, 10, 10) + fill(255) + ellipse(mouse_x - 12, player_y - 12, 5, 5) + ellipse(mouse_x + 12, player_y - 12, 5, 5) + + # Mouth + fill(0) + ellipse(mouse_x, player_y + 15, 15, 10) + fill(178, 200, 145) + ellipse(mouse_x, player_y + 20, 10, 10) + +def draw_player(): + + global player_y, safe, score, level + + player_y = int(height * 0.8) + + collide = get(mouse_x, player_y) + collide2 = get(mouse_x, player_y + 30) + collide3 = get(mouse_x + 30, player_y) + collide4 = get(mouse_x, player_y - 30) + + if mouse_x < width: # off the left of the screen + collide2 = safe + + if mouse_x > width: # off the right of the screen + collide3 = safe + + #print(collide, collide2, collide3, collide4) + + if collide == safe and collide2 == safe and collide3 == safe and collide4 == safe: + safe_player() + score += level + else: # Collided + crashed_player() + level = 0 + +def draw_obstacles(): + + global level + + seed(41143644) + + if frame_count & height == height - 1 and level < 5: + level += 1 + print('You reached level', level) + + for i in range(9 + level): + ob_x = randint(0, width) + ob_y = randint(0, height) + frame_count + ob_y %= height + text('🦠', ob_x, ob_y) + +def setup(): +# Put code to run once here + size(400, 400) # width and height + no_stroke() + text_size(40) + text_align(CENTER, TOP) + +def draw(): +# Put code to run every frame here + global safe, score, level + + safe = Color(149, 161, 195) + + if level > 0: + background(safe) + fill(145, 134, 126) + text('Score: ' + str(score), width/2, 20) + draw_obstacles() + draw_player() + +# Keep this to run your code +run() diff --git a/lib/tasks/project_components/dont_collide_avoid_germs_example/project_config.yml b/lib/tasks/project_components/dont_collide_avoid_germs_example/project_config.yml new file mode 100644 index 000000000..f6a4355fe --- /dev/null +++ b/lib/tasks/project_components/dont_collide_avoid_germs_example/project_config.yml @@ -0,0 +1,8 @@ +NAME: "Don't Collide: Avoid the Germs" +IDENTIFIER: "avoid-germs-example" +COMPONENTS: + - name: "main" + extension: "py" + location: "main.py" + index: 0 + default: true diff --git a/lib/tasks/project_components/dont_collide_clean_car_example/main.py b/lib/tasks/project_components/dont_collide_clean_car_example/main.py new file mode 100644 index 000000000..cdbbf093c --- /dev/null +++ b/lib/tasks/project_components/dont_collide_clean_car_example/main.py @@ -0,0 +1,86 @@ +#!/bin/python3 + +# Import library code +from p5 import * +from random import randint, seed + +level = 1 +score = 0 + +# The draw_obstacle function goes here +def draw_obstacles(): + + global level + + seed(123456789) + + if frame_count % width == width - 1 and level < 10: + level += 1 + print('You reached level', level) + + for i in range(6 + level): + ob_x = randint(0, width) - (frame_count * level) + ob_y = randint(0, height) + ob_x %= width # wrap around + text('πŸ’©', ob_x, ob_y) + +# The draw_player function goes here +def draw_player(): + + global score, level + + player_x = int(width * 0.2) + player_y = mouse_y + + collide = get(player_x + 50, player_y + 15) + collide2 = get(player_x + 50, player_y - 15) + collide3 = get(player_x, player_y + 15) + collide4 = get(player_x, player_y - 15) + collide5 = get(player_x - 50, player_y + 15) + collide6 = get(player_x - 50, player_y - 15) + + if player_y > height - 18: # Off the bottom of the screen + collide = safe + collide3 = safe + collide5 = safe + + elif player_y < 18: # Off the top of the screen + collide2 = safe + collide4 = safe + collide6 = safe + + if collide == safe and collide2 == safe and collide3 == safe and collide4 == safe: + image(car, player_x, player_y, 100, 31) + score += level + else: + text('πŸ’₯', player_x, player_y) + level = 0 + + +def setup(): + # Setup your animation here + global car + + size(400, 400) + car = load_image('car.png') + image_mode(CENTER) + + +def draw(): + # Things to do in every frame + global score, safe, level + safe = Color(128) + + if level > 0: + background(safe) + fill(255) + text_size(16) + text_align(RIGHT, TOP) + text('Score', width * 0.45, 10, width * 0.5, 20) + text(str(score), width * 0.45, 25, width * 0.5, 20) + text_size(20) + text_align(CENTER, TOP) # position around the centre, top + draw_obstacles() + draw_player() + +run() diff --git a/lib/tasks/project_components/dont_collide_clean_car_example/project_config.yml b/lib/tasks/project_components/dont_collide_clean_car_example/project_config.yml new file mode 100644 index 000000000..298aafcc3 --- /dev/null +++ b/lib/tasks/project_components/dont_collide_clean_car_example/project_config.yml @@ -0,0 +1,8 @@ +NAME: "Don't Collide: Clean Car" +IDENTIFIER: "clean-car-example" +COMPONENTS: + - name: "main" + extension: "py" + location: "main.py" + index: 0 + default: true diff --git a/lib/tasks/project_components/dont_collide_dodge_asteroids_example/main.py b/lib/tasks/project_components/dont_collide_dodge_asteroids_example/main.py new file mode 100644 index 000000000..af584307b --- /dev/null +++ b/lib/tasks/project_components/dont_collide_dodge_asteroids_example/main.py @@ -0,0 +1,129 @@ +#!/bin/python3 + +# Import library code +from p5 import * +from random import randint, seed + +level = 1 +score = 0 +lives = 3 +invun = 0 + +# The draw_obstacle function goes here +def draw_obstacles(): + + global level + + seed(random_seed) + + if frame_count % height == height - 1 and level < 8: + level += 1 + print('You reached level', level) + + for i in range(6 + level): + ob_x = randint(0, width) + ob_y = randint(0, height) + (frame_count * level) + ob_y %= height # wrap around + push_matrix() + translate(ob_x, ob_y) + rotate(degrees(randint(1, 359)+frame_count / 1000)) + image(rock, 0, 0, randint(18,24), randint(18,24)) + pop_matrix() + + +# The draw_player function goes here +def draw_player(): + + global score, level, lives, invun + + player_y = int(height * 0.8) + player_x = mouse_x + + collide = get(player_x, player_y) + collide2 = get(player_x - 18, player_y + 17) + collide3 = get(player_x + 18, player_y + 17) + collide4 = get(player_x, player_y + 25) + + if player_x < width: # off the left of the screen + collide2 = safe + + if player_x > width: # off the right of the screen + collide3 = safe + + if (collide == safe and collide2 == safe and collide3 == safe and collide4 == safe) or invun > 0: + if lives == 0 and frame_count % 12 == 0: + tint(200, 0, 0) + + image(rocket, player_x, player_y + 25, 64, 64) + score += level + invun -= 1 + no_tint() + + if invun > 0: + stroke(220) + fill(220, 220, 220, 60) + ellipse(player_x, player_y + 18, 47, 47) + + elif lives > 0: + lives -= 1 + invun = 50 + tint(200, 0, 0) + image(rocket, player_x, player_y + 25, 64, 64) + no_tint() + score += level + else: + text('πŸ’₯', player_x + 10, player_y + 5) + level = 0 + + +def display_score(): + global level + + fill(255) + text_size(16) + text_align(RIGHT, TOP) + text('Score', width * 0.45, 10, width * 0.5, 20) + text(str(score), width * 0.45, 25, width * 0.5, 20) + + if score > 10000: + level = 0 + print('πŸŽ‰πŸŽ‰ You win! πŸŽ‰πŸŽ‰') + + +def display_lives(): + fill(255) + text_size(16) + text_align(LEFT, TOP) + text('Lives', width * 0.05, 10, 30, 20) + + for i in range(lives): + image(rocket, width * 0.05 + i * 25, 40, 20, 20) + + +def setup(): + # Setup your animation here + global rocket, rock, random_seed + + text_size(40) + text_align(CENTER, TOP) # position around the centre, top + size(400, 400) + + rocket = load_image('rocket.png') + rock = load_image('moon.png') + random_seed = randint(0, 1000000) + +def draw(): + # Things to do in every frame + global score, safe, level + safe = Color(0) + + if level > 0: + background(safe) + fill(255) + image_mode(CENTER) + draw_obstacles() + draw_player() + display_score() + display_lives() + +run() diff --git a/lib/tasks/project_components/dont_collide_dodge_asteroids_example/project_config.yml b/lib/tasks/project_components/dont_collide_dodge_asteroids_example/project_config.yml new file mode 100644 index 000000000..dcf0ca6d9 --- /dev/null +++ b/lib/tasks/project_components/dont_collide_dodge_asteroids_example/project_config.yml @@ -0,0 +1,8 @@ +NAME: "Don't Collide: Dodge Asteroids" +IDENTIFIER: "dodge-asteroids-example" +COMPONENTS: + - name: "main" + extension: "py" + location: "main.py" + index: 0 + default: true diff --git a/lib/tasks/project_components/dont_collide_dont_pop_example/main.py b/lib/tasks/project_components/dont_collide_dont_pop_example/main.py new file mode 100644 index 000000000..91efb48b1 --- /dev/null +++ b/lib/tasks/project_components/dont_collide_dont_pop_example/main.py @@ -0,0 +1,79 @@ +#!/bin/python3 + +# Import library code +from p5 import * +from random import randint, seed + +level = 1 +score = 0 + +# The draw_obstacle function goes here +def draw_obstacles(): + + global level + + seed(12345678) + + if frame_count % height == height - 1 and level < 5: + level += 1 + print('You reached level', level) + + for i in range(6 + level): + ob_x = randint(0, height) + ob_y = randint(0, height) + (frame_count * level) + ob_y %= height # wrap around + text('🌡', ob_x, ob_y) + + +# The draw_player function goes here +def draw_player(): + + global score, level + + player_y = int(height * 0.8) + + no_fill() + #ellipse(mouse_x, player_y, 10, 10) # draw collision point + #ellipse(mouse_x, player_y + 40, 10, 10) + #ellipse(mouse_x - 12, player_y + 20, 10, 10) + #ellipse(mouse_x + 12, player_y + 20, 10, 10) + + collide = get(mouse_x, player_y) + collide2 = get(mouse_x - 12, player_y + 20) + collide3 = get(mouse_x + 12, player_y + 20) + collide4 = get(mouse_x, player_y + 40) + + if mouse_x < width: # off the left of the screen + collide2 = safe + + if mouse_x > width: # off the right of the screen + collide3 = safe + + if collide == safe and collide2 == safe and collide3 == safe and collide4 == safe: + text('🎈', mouse_x, player_y) + score += level + else: + text('πŸ’₯', mouse_x, player_y) + level = 0 + + +def setup(): + # Setup your animation here + text_size(40) + text_align(CENTER, TOP) # position around the centre, top + size(400, 400) + + +def draw(): + # Things to do in every frame + global score, safe, level + safe = Color(200, 150, 0) + + if level > 0: + background(safe) + fill(255) + text('Score: ' + str(score), width/2, 20) + draw_obstacles() + draw_player() + +run() diff --git a/lib/tasks/project_components/dont_collide_dont_pop_example/project_config.yml b/lib/tasks/project_components/dont_collide_dont_pop_example/project_config.yml new file mode 100644 index 000000000..94ccf6ab8 --- /dev/null +++ b/lib/tasks/project_components/dont_collide_dont_pop_example/project_config.yml @@ -0,0 +1,8 @@ +NAME: "Don't Collide: Don't Pop" +IDENTIFIER: "dont-pop-example" +COMPONENTS: + - name: "main" + extension: "py" + location: "main.py" + index: 0 + default: true diff --git a/lib/tasks/project_components/dont_collide_skiing_cat_example/main.py b/lib/tasks/project_components/dont_collide_skiing_cat_example/main.py new file mode 100644 index 000000000..acbad49da --- /dev/null +++ b/lib/tasks/project_components/dont_collide_skiing_cat_example/main.py @@ -0,0 +1,75 @@ +#!/bin/python3 + +# Import library code +from p5 import * +from random import randint, seed + +speed = 1 +score = 0 + +# The draw_background function goes here +def draw_obstacles(): + + global speed + + seed(12345678) + + if frame_count % height == height - 1 and speed < 5: + speed += 1 + print('You reached level', speed) + + for i in range(6): + ob_x = randint(0, height) + ob_y = randint(0, height) + (frame_count * speed) + ob_y %= height # wrap around + no_stroke() + fill(0,255,0) + triangle(ob_x + 20, ob_y + 20, ob_x + 10, ob_y + 40, ob_x + 30, ob_y + 40) + triangle(ob_x + 20, ob_y + 30, ob_x + 5, ob_y + 55, ob_x + 35, ob_y + 55) + triangle(ob_x + 20, ob_y + 40, ob_x + 0, ob_y + 70, ob_x + 40, ob_y + 70) + fill(150,100,100) + rect(ob_x + 15, ob_y + 70, 10, 10) + +# The draw_player function goes here +def draw_player(): + + global score, speed, skiing, crashed + + player_y = int(height * 0.8) + + fill(safe) + + collide = get(mouse_x, player_y) + + if collide == safe: + image(skiing, mouse_x, player_y, 30, 30) + score += speed + else: + image(crashed, mouse_x, player_y, 30, 30) + speed = 0 + + +def setup(): + + global skiing, crashed + + # Setup your animation here + size(400, 400) + text_size(40) + text_align(CENTER, TOP) # position around the centre + skiing = load_image('skiing.png') + crashed = load_image('fallenover.png') + +def draw(): + # Things to do in every frame + global score, safe, speed, skiing, crashed + safe = Color(255) + + if speed > 0: + background(safe) + fill(0) + text('Score: ' + str(score), width/2, 20) + draw_obstacles() + draw_player() + +run() diff --git a/lib/tasks/project_components/dont_collide_skiing_cat_example/project_config.yml b/lib/tasks/project_components/dont_collide_skiing_cat_example/project_config.yml new file mode 100644 index 000000000..59324b6f7 --- /dev/null +++ b/lib/tasks/project_components/dont_collide_skiing_cat_example/project_config.yml @@ -0,0 +1,8 @@ +NAME: "Don't Collide: Skiing Cat" +IDENTIFIER: "skiing-cat-example" +COMPONENTS: + - name: "main" + extension: "py" + location: "main.py" + index: 0 + default: true diff --git a/lib/tasks/project_components/make_a_face_animated_example/main.py b/lib/tasks/project_components/make_a_face_animated_example/main.py new file mode 100644 index 000000000..d8d9eb3b8 --- /dev/null +++ b/lib/tasks/project_components/make_a_face_animated_example/main.py @@ -0,0 +1,44 @@ +#!/bin/python3 + +from p5 import * +import random + +def setup(): + size(400, 400) + no_stroke() + +def draw(): + background(255) + + # Hair and face + fill(0) + ellipse(200, 220, 220, 230) + fill(251, 233, 201) + ellipse(200, 245, 200, 200) + fill(0) + ellipse(245, 185, 120, 130) + ellipse(155, 185, 120, 130) + fill(230 , 108, 129) + for i in range (0, 30): + fill(random.randint(100, 230) , random.randint(90, 110), random.randint(100, 130)) + ellipse(random.randint(100,300), random.randint(150,210), 20, 20) + + # Eyes + fill(0) + ellipse(160, 270, 85, 30) + ellipse(240, 270, 85, 30) + fill(251, 233, 201) + ellipse(160, 280, 80, 30) + ellipse(240, 280, 80, 30) + fill(0) + ellipse(160, 290, 30, 30) + ellipse(240, 290, 30, 30) + fill(255) + ellipse(165, 285, 10, 10) + ellipse(245, 285, 10, 10) + + # Mouth + fill(0) + rect(185, 320, 30, 5) + +run(frame_rate=5) diff --git a/lib/tasks/project_components/make_a_face_animated_example/project_config.yml b/lib/tasks/project_components/make_a_face_animated_example/project_config.yml new file mode 100644 index 000000000..57df63fb2 --- /dev/null +++ b/lib/tasks/project_components/make_a_face_animated_example/project_config.yml @@ -0,0 +1,8 @@ +NAME: "Make A Face Animated Example" +IDENTIFIER: "animated-face-example" +COMPONENTS: + - name: "main" + extension: "py" + location: "main.py" + index: 0 + default: true diff --git a/lib/tasks/project_components/make_a_face_interactive_example/main.py b/lib/tasks/project_components/make_a_face_interactive_example/main.py new file mode 100644 index 000000000..94e42f57d --- /dev/null +++ b/lib/tasks/project_components/make_a_face_interactive_example/main.py @@ -0,0 +1,57 @@ +#!/bin/python3 + +from p5 import * +from random import randint + +def sad(x_middle, y_eye, y_mouth): + ellipse(x_middle - 50, y_eye - 20, 60, 50) # x, y, width, height + ellipse(x_middle + 50, y_eye - 20, 60, 50) + ellipse(x_middle, y_mouth + 30, 100, 65) + +def happy(x_middle, y_eye, y_mouth): + ellipse(x_middle - 50, y_eye + 20, 60, 50) # x, y, width, height + ellipse(x_middle + 50, y_eye + 20, 60, 50) + ellipse(x_middle, y_mouth - 30, 100, 65) + +def setup(): +# Put code to run once here + size(400, 400) # width and height + background(0, 0, 0) # move under draw() to reset the drawing every frame + rect_mode(CENTER) + no_stroke() + +def draw(): +# Put code to run every frame here + mask_width = width / 2 + x_middle = width / 2 + y_eye = 180 + y_mouth = 255 + # draw mask + fill(255, 255, 255) # white + rect(200, 150, mask_width, mask_width) + ellipse(x_middle, 250, mask_width, 140) + # eyes and mouth + fill(0) # black + ellipse(x_middle - 50, y_eye, 60, 50) # x, y, width, height + ellipse(x_middle + 50 , y_eye, 60, 50) + ellipse(x_middle, y_mouth, 100, 75) + # partly cover eyes and mouth + fill(255) + if mouse_x > x_middle: + happy(x_middle, y_eye, y_mouth) + else: + sad(x_middle, y_eye, y_mouth) + # cover top of mask + fill(0) + ellipse(x_middle, 60, 250, 90) + # shade half of the mask + fill(0, 25) + rect(300, 200, width/2, height) + +def mouse_pressed(): +# Put code to run when the mouse is pressed here + print(mouse_x, mouse_y) + +# Keep this to run your code +run() + diff --git a/lib/tasks/project_components/make_a_face_interactive_example/project_config.yml b/lib/tasks/project_components/make_a_face_interactive_example/project_config.yml new file mode 100644 index 000000000..aa6cd38fb --- /dev/null +++ b/lib/tasks/project_components/make_a_face_interactive_example/project_config.yml @@ -0,0 +1,8 @@ +NAME: "Make A Face Interactive Example" +IDENTIFIER: "interactive-face-example" +COMPONENTS: + - name: "main" + extension: "py" + location: "main.py" + index: 0 + default: true diff --git a/lib/tasks/project_components/make_a_face_kawaii_fruit_example/main.py b/lib/tasks/project_components/make_a_face_kawaii_fruit_example/main.py new file mode 100644 index 000000000..05269a879 --- /dev/null +++ b/lib/tasks/project_components/make_a_face_kawaii_fruit_example/main.py @@ -0,0 +1,42 @@ +#!/bin/python3 + +from p5 import * + +def setup(): + size(400, 400) + no_stroke() + + +def draw(): + background(255) + orange = Color(255, 165, 0) + brown = Color(200, 120, 0) + green = Color(100, 155, 0) + fill(orange) + ellipse(200, 200, 200, 190) + fill(0) + # Eyes + ellipse(160, 220, 30, 30) + ellipse(240, 220, 30, 30) + fill(255) + ellipse(165, 215, 10, 10) + ellipse(245, 215, 10, 10) + # Mouth + fill(0) + ellipse(200, 240, 15, 15) + fill(orange) + ellipse(200, 235, 15, 15) + # Highlights + fill(255, 70) + ellipse(170, 150, 35, 35) + ellipse(150, 160, 25, 25) + # stalk + fill(brown) + triangle(200, 130, 220, 60, 240, 60); + fill(green) + translate(180, 85) + rotate(radians(45)) + ellipse(0, 0, 75, 35) + +run() + diff --git a/lib/tasks/project_components/make_a_face_kawaii_fruit_example/project_config.yml b/lib/tasks/project_components/make_a_face_kawaii_fruit_example/project_config.yml new file mode 100644 index 000000000..2cedb232d --- /dev/null +++ b/lib/tasks/project_components/make_a_face_kawaii_fruit_example/project_config.yml @@ -0,0 +1,8 @@ +NAME: "Make A Face Kawaii Fruit Example" +IDENTIFIER: "fruit-face-example" +COMPONENTS: + - name: "main" + extension: "py" + location: "main.py" + index: 0 + default: true diff --git a/lib/tasks/project_components/make_a_face_stacked_faces_example/main.py b/lib/tasks/project_components/make_a_face_stacked_faces_example/main.py new file mode 100644 index 000000000..caff6b4de --- /dev/null +++ b/lib/tasks/project_components/make_a_face_stacked_faces_example/main.py @@ -0,0 +1,96 @@ +#!/bin/python3 + +from p5 import * + +def setup(): + size(400, 600) + background(255, 255, 255) + no_stroke() + + +def draw(): + blue = Color(92, 204, 206) + green = Color(149, 212, 122) + red = Color(239, 62, 91) + purple = Color(75, 37, 109) + brown = Color(178, 162, 150) + grey = Color(201, 201, 201) + lilac = Color(160, 158, 214) + + # Top face background + fill(blue) + rect(50, 100, 300, 200) + fill(0) + + # Top face Hair + fill(purple) + gap = 0 + for i in range (0,5): + triangle(100+gap, 140, 120+gap, 120, 140+gap, 140) + gap = gap+40 + + # Top face Left Eye + fill(grey) + rect(80, 190, 100, 50) + fill(red) + triangle(190, 250, 70, 150, 180, 160); + fill(green) + triangle(190, 250, 60, 160, 180, 170); + fill(lilac) + ellipse(160, 200, 30, 30) + + # Top face Right Eye + fill(grey) + rect(220, 190, 100, 50) + fill(red) + triangle(210, 250, 330, 150, 220, 160); + fill(green) + triangle(210, 250, 340, 160, 220, 170); + fill(lilac) + ellipse(240, 200, 30, 30) + + # Top face Mouth + fill(brown) + rect(100, 220, 200, 50) + fill(purple) + rect(110, 240, 180, 10) + +# Bottom face background + fill(purple) + rect(50, 300, 300, 200) + fill(0) + + # Bottom face Hair + fill(green) + gap = 0 + for i in range (0,5): + triangle(100+gap, 340, 120+gap, 320, 140+gap, 340) + gap = gap+40 + + # Bottom face Left Eye + fill(red) + rect(80, 390, 100, 50) + fill(lilac) + triangle(190, 450, 70, 350, 180, 360); + fill(brown) + triangle(190, 450, 60, 360, 180, 370); + fill(purple) + ellipse(160, 400, 30, 30) + + # Bottom face Right Eye + fill(red) + rect(220, 390, 100, 50) + fill(lilac) + triangle(210, 450, 330, 350, 220, 360); + fill(brown) + triangle(210, 450, 340, 360, 220, 370); + fill(purple) + ellipse(240, 400, 30, 30) + + # Bottom face Mouth + fill(green) + rect(100, 420, 200, 50) + fill(red) + rect(110, 440, 180, 10) + +run() diff --git a/lib/tasks/project_components/make_a_face_stacked_faces_example/project_config.yml b/lib/tasks/project_components/make_a_face_stacked_faces_example/project_config.yml new file mode 100644 index 000000000..2db4d49e2 --- /dev/null +++ b/lib/tasks/project_components/make_a_face_stacked_faces_example/project_config.yml @@ -0,0 +1,8 @@ +NAME: "Make A Face: Stacked Faces Example" +IDENTIFIER: "stacked-faces-example" +COMPONENTS: + - name: "main" + extension: "py" + location: "main.py" + index: 0 + default: true diff --git a/lib/tasks/project_components/make_a_face_starter/grid.py b/lib/tasks/project_components/make_a_face_starter/grid.py new file mode 100644 index 000000000..764ad91da --- /dev/null +++ b/lib/tasks/project_components/make_a_face_starter/grid.py @@ -0,0 +1,14 @@ +def grid(): + push_matrix() + stroke(200) + fill(0) + line(0, height/2, width, height/2) + line(width/2, 0, width/2, height) + x_coords = [0, width/2, width] + y_coords = [0, height/2, height] + + for x in x_coords: + for y in y_coords: + show_coord(x, y) + + pop_matrix() diff --git a/lib/tasks/project_components/make_a_face_starter/main.py b/lib/tasks/project_components/make_a_face_starter/main.py new file mode 100644 index 000000000..140cbaadf --- /dev/null +++ b/lib/tasks/project_components/make_a_face_starter/main.py @@ -0,0 +1,16 @@ +#!/bin/python3 + +from p5 import * +from grid import * + +def setup(): + # Put code to run once here + size(400, 400) # width and height + +def draw(): + # Put code to run every frame here + background(255, 255, 255) # move under draw() to reset the drawing every frame + grid() # add a # to the beginning of this line to hide the grid + +# Keep this to run your code +run() diff --git a/lib/tasks/project_components/make_a_face_starter/project_config.yml b/lib/tasks/project_components/make_a_face_starter/project_config.yml new file mode 100644 index 000000000..a4fcfc07e --- /dev/null +++ b/lib/tasks/project_components/make_a_face_starter/project_config.yml @@ -0,0 +1,13 @@ +NAME: "Make A Face" +IDENTIFIER: "make-face-starter" +COMPONENTS: + - name: "main" + extension: "py" + location: "main.py" + index: 0 + default: true + - name: "grid" + extension: "py" + location: "grid.py" + index: 1 + default: false diff --git a/lib/tasks/project_components/make_a_face_tribal_mask_example/main.py b/lib/tasks/project_components/make_a_face_tribal_mask_example/main.py new file mode 100644 index 000000000..781c29bac --- /dev/null +++ b/lib/tasks/project_components/make_a_face_tribal_mask_example/main.py @@ -0,0 +1,55 @@ +#!/bin/python3 + +from p5 import * + +def setup(): + size(400, 400) + no_stroke() + + +def draw(): + background(255) + fill(74, 50, 47) + ellipse(200, 200, 200, 190) + fill(0) + + # Eyes + fill(175, 65, 0) + ellipse(160, 180, 60, 60) + ellipse(240, 180, 60, 60) + fill(0) + ellipse(160, 180, 30, 30) + ellipse(240, 180, 30, 30) + fill(255) + ellipse(165, 175, 10, 10) + ellipse(245, 175, 10, 10) + + # Nose + fill(108, 75, 73) + triangle(185, 240, 200, 160, 215, 240) + + # Face markings + gap = 0 + for i in range (0,6): + fill(0, 240, 209) + ellipse(150+gap, 140, 10, 10) + fill(108, 75, 73) + ellipse(150+gap, 220, 10, 10) + gap = gap+20 + + # Mouth + fill(185, 85, 0) + ellipse(190, 260, 30, 30) + ellipse(210, 260, 30, 30) + ellipse(195, 275, 20, 20) + ellipse(205, 275, 20, 20) + fill(0) + rect(185, 265, 30, 3) + + # Hair + fill(246, 170, 19) + triangle(200, 130, 220, 60, 240, 60) + triangle(200, 130, 180, 60, 160, 60) + +run() + diff --git a/lib/tasks/project_components/make_a_face_tribal_mask_example/project_config.yml b/lib/tasks/project_components/make_a_face_tribal_mask_example/project_config.yml new file mode 100644 index 000000000..b800c6acd --- /dev/null +++ b/lib/tasks/project_components/make_a_face_tribal_mask_example/project_config.yml @@ -0,0 +1,8 @@ +NAME: "Make A Face: Tribal Mask Example" +IDENTIFIER: "tribal-mask-example" +COMPONENTS: + - name: "main" + extension: "py" + location: "main.py" + index: 0 + default: true diff --git a/lib/tasks/project_components/powerful_patterns_art_deco_wallpaper_example/main.py b/lib/tasks/project_components/powerful_patterns_art_deco_wallpaper_example/main.py new file mode 100644 index 000000000..4efa15ed4 --- /dev/null +++ b/lib/tasks/project_components/powerful_patterns_art_deco_wallpaper_example/main.py @@ -0,0 +1,35 @@ +#!/bin/python3 + +from p5 import * +from random import randint + +def motif(): + global circle_size + for i in range(5): + ellipse(0, 0, circle_size / 5 * (5 - i), circle_size / 5 * (5 - i)) + +def setup(): + size(400, 400) + print('πŸ–Œ This art uses lots of circles!') + + global circle_size + + circle_size = 50 + +def draw(): + + # Pattern colours + stroke(40, 35, 100) # blue + stroke_weight(2) # thick border + fill(200, 180, 128) # gold + + translate(0,0) # start from the top left of the screen + + if frame_count <= 16: # creates 16 rows then stops + for row in range (frame_count): # animates 1 row at a time + for shape in range (16): # create a row of motifs + motif() + translate(circle_size / 2, 0) + translate(-width, circle_size / 2) # move down to start next row + +run(frame_rate=3) diff --git a/lib/tasks/project_components/powerful_patterns_art_deco_wallpaper_example/project_config.yml b/lib/tasks/project_components/powerful_patterns_art_deco_wallpaper_example/project_config.yml new file mode 100644 index 000000000..2aa28922f --- /dev/null +++ b/lib/tasks/project_components/powerful_patterns_art_deco_wallpaper_example/project_config.yml @@ -0,0 +1,8 @@ +NAME: "Powerful Patterns: Art Deco Wallpaper Example" +IDENTIFIER: "art-deco-example" +COMPONENTS: + - name: "main" + extension: "py" + location: "main.py" + index: 0 + default: true diff --git a/lib/tasks/project_components/powerful_patterns_kek_lepis_sarawak/main.py b/lib/tasks/project_components/powerful_patterns_kek_lepis_sarawak/main.py new file mode 100644 index 000000000..e9816f307 --- /dev/null +++ b/lib/tasks/project_components/powerful_patterns_kek_lepis_sarawak/main.py @@ -0,0 +1,66 @@ +#!/bin/python3 + +from p5 import * +from time import * + +# Based on the amazing Malaysian geometric cake art: Kek lapis Sarawak + +def quadrant(): + + # Choose some gorgeous colours for the cake layers + turquoise = Color(64, 224, 208) + gold = Color(255, 215, 0) + tomato = Color(255, 99, 71) + + # Jam sticks the layers together + jam = Color(255, 165, 0) + stroke(jam) + stroke_weight(2) # Change the number to change the amount of jam + + # Nine layers of cake, repeating the 3 colours 3 times + for i in range(3): + start_y = i * 60 # height of 3 blocks of cake + fill(turquoise) + rect(0, start_y, 180, 20) + fill(gold) + rect(0, start_y + 20, 180, 20) + fill(tomato) + rect(0, start_y + 40, 180, 20) + + +def outer(): + + # Thehe cake is wrapped in an outer layer + yellowgreen = Color(154, 205, 50) + + no_fill() # Don't cover up the cake quadrants! + stroke(yellowgreen) + stroke_weight(20) + rect(10, 10, 380, 380, 20) + + +def setup(): + size(400, 400) # make the cake square + background(255, 255, 255, 0) # transparent background + + +def draw(): + + # Define a quarter turn so our code is easy to read + quarter = radians(90) + + translate(200, 200) # start from the center + + # Make the bottom right quarter of the cake then rotate for the other quarters + + if frame_count <= 4: # draw up to 4 quadrants + for i in range(frame_count): + quadrant() + rotate(quarter) + + if frame_count == 5: # add the outer layer + translate(-200, -200) # back to the top corner + outer() # outer layer + + +run(frame_rate = 5) # 5 frames per second diff --git a/lib/tasks/project_components/powerful_patterns_kek_lepis_sarawak/project_config.yml b/lib/tasks/project_components/powerful_patterns_kek_lepis_sarawak/project_config.yml new file mode 100644 index 000000000..fbf378f6f --- /dev/null +++ b/lib/tasks/project_components/powerful_patterns_kek_lepis_sarawak/project_config.yml @@ -0,0 +1,8 @@ +NAME: "Powerful Patterns: Kek Lepis Sarawak Example" +IDENTIFIER: "repeated-patterns-example" +COMPONENTS: + - name: "main" + extension: "py" + location: "main.py" + index: 0 + default: true diff --git a/lib/tasks/project_components/powerful_patterns_mcewen_tartan_example/main.py b/lib/tasks/project_components/powerful_patterns_mcewen_tartan_example/main.py new file mode 100644 index 000000000..4957ea44d --- /dev/null +++ b/lib/tasks/project_components/powerful_patterns_mcewen_tartan_example/main.py @@ -0,0 +1,77 @@ +#!/bin/python3 + +from p5 import * + +def setup(): + size(400, 400) + +def draw(): + + lines = 10 * frame_count # Use in shape width/length to animate over time + + # McEwen tartan colours + # Base square colours + BLUE = Color(83, 143, 200) + GREEN = Color(78, 163, 162) + BASE_COLORS = [GREEN, BLUE] + + # Cross colours + YELLOW = Color(155, 176, 135) + RED = Color(155, 129, 113) + CROSS_COLORS = [YELLOW, RED] + + # Stitching and overlap colour + GREY = Color(78, 99, 86) + + # Draw all the GREEN and BLUE alternating Base squares + no_stroke() + y_coordinate = 0 + squares = width/square_size + + for i in range (int(squares)): + gap = 0 + for j in range (int(squares)): + fill(BASE_COLORS[j % 2]) # GREEN and BLUE + rect(gap, y_coordinate, square_size, square_size) + gap = gap + square_size + y_coordinate = y_coordinate + square_size + + # Crosses + stroke(GREY) + + # DRAW THE YELLOW and RED alternating crosses + for i in range (4): + fill(YELLOW) + cross = square_size / 2 - 2 + for i in range (int(squares/2)): + fill(CROSS_COLORS[i % 2]) # YELLOW and RED + rect(cross, 0, 4, lines) + rect(0, cross, lines, 4) + cross = cross + 2 * square_size + # Draw the stiching crosses + no_fill() + cross = square_size + square_size / 2 - 2 + for i in range (int(squares)): + rect(cross, 0, 4, lines) + rect(0, cross, lines, 4) + cross = cross + square_size + + # Draw the grey lines where material overlaps + no_stroke() + fill(GREY, 100) + gap = square_size - 4 + for i in range (int(squares)): + rect(gap, 0, 8, lines) + gap = gap + square_size + gap = square_size - 4 + for i in range (int(squares)): + rect(0, gap, lines, 8) + gap = gap + square_size + +print('🏴󠁧󠁒󠁳󠁣󠁴󠁿󠁒󠁳󠁣󠁴󠁿 This is McEwen Tartan 🏴󠁧󠁒󠁳󠁣󠁴󠁿󠁧󠁒󠁳󠁣󠁴󠁿') +square_size = int(input('What size 🏴󠁧󠁒󠁳󠁣󠁴󠁿tartan would you like? 20, 50, or 100')) + +run(frame_rate=10) + + + diff --git a/lib/tasks/project_components/powerful_patterns_mcewen_tartan_example/project_config.yml b/lib/tasks/project_components/powerful_patterns_mcewen_tartan_example/project_config.yml new file mode 100644 index 000000000..018f93580 --- /dev/null +++ b/lib/tasks/project_components/powerful_patterns_mcewen_tartan_example/project_config.yml @@ -0,0 +1,8 @@ +NAME: "Powerful Patterns: McEwen Tartan" +IDENTIFIER: "mcewen-tartan-example" +COMPONENTS: + - name: "main" + extension: "py" + location: "main.py" + index: 0 + default: true diff --git a/lib/tasks/project_components/powerful_patterns_random_faces_example/main.py b/lib/tasks/project_components/powerful_patterns_random_faces_example/main.py new file mode 100644 index 000000000..8695261ea --- /dev/null +++ b/lib/tasks/project_components/powerful_patterns_random_faces_example/main.py @@ -0,0 +1,45 @@ +#!/bin/python3 + +from p5 import * +from random import randint + +def draw_motif(): + orange = Color(191, 64, 191) + brown = Color(200, 120, 0) + green = Color(100, 155, 0) + fill(orange) + ellipse(200, 200, 200, 190) + fill(0) + # Eyes + ellipse(160, 190, 30, 30) + ellipse(240, 190, 30, 30) + fill(255) + ellipse(165, 200, 10, 10) + ellipse(245, 200, 10, 10) + # Mouth + no_fill() + stroke(255, 255, 255) + ellipse(150, 250, 30, 30) + ellipse(250, 250, 30, 30) + fill(255, 255, 255) + no_stroke() + rect(150, 230, 100, 40) + fill(108, 200, 206) + rect(152, 235, 96, 30) + + +def setup(): + size(400, 400) + background(255) + no_stroke() + + +def draw(): + push_matrix() + translate(randint(-50, 350), randint(-50, 350)) # offset by the width of the quarter-size face + scale(0.25, 0.25) # quarter size paths + draw_motif() + pop_matrix() + + +run(frame_rate=10) diff --git a/lib/tasks/project_components/powerful_patterns_random_faces_example/project_config.yml b/lib/tasks/project_components/powerful_patterns_random_faces_example/project_config.yml new file mode 100644 index 000000000..f985d326a --- /dev/null +++ b/lib/tasks/project_components/powerful_patterns_random_faces_example/project_config.yml @@ -0,0 +1,8 @@ +NAME: "Powerful Patterns: Random Faces" +IDENTIFIER: "random-faces-example" +COMPONENTS: + - name: "main" + extension: "py" + location: "main.py" + index: 0 + default: true diff --git a/lib/tasks/project_components/powerful_patterns_spirals_example/main.py b/lib/tasks/project_components/powerful_patterns_spirals_example/main.py new file mode 100644 index 000000000..629f32eff --- /dev/null +++ b/lib/tasks/project_components/powerful_patterns_spirals_example/main.py @@ -0,0 +1,29 @@ +#!/bin/python3 + +from p5 import * +from math import random +from random import randint + +def motif(): + fill(randint(0, 255),randint(0, 255) ,randint(0, 255)) + ellipse(0, 0, 25, 25) + fill(0, 0, 0) + ellipse(0, 0, 15, 15) + fill(randint(0, 255),randint(0, 255) ,randint(0, 255)) + for i in range(4): # a short row of squares + rect(i * 5, 0, 5, 5) + +def setup(): + size(400, 400) + stroke_weight(2) # thick border + background(255) + +def draw(): + translate(200, 200) # start from the centre of the screen + if frame_count < 150: + for i in range(frame_count): # animates the pattern + motif() + rotate(5) # turns the motif + translate(i,i) # moves the motif + +run(frame_rate=10) # fast animation diff --git a/lib/tasks/project_components/powerful_patterns_spirals_example/project_config.yml b/lib/tasks/project_components/powerful_patterns_spirals_example/project_config.yml new file mode 100644 index 000000000..8a99e7eca --- /dev/null +++ b/lib/tasks/project_components/powerful_patterns_spirals_example/project_config.yml @@ -0,0 +1,8 @@ +NAME: "Powerful Patterns: Spirals" +IDENTIFIER: "spirals-pattern-example" +COMPONENTS: + - name: "main" + extension: "py" + location: "main.py" + index: 0 + default: true diff --git a/lib/tasks/project_components/powerful_patterns_starter/main.py b/lib/tasks/project_components/powerful_patterns_starter/main.py new file mode 100644 index 000000000..84f2849da --- /dev/null +++ b/lib/tasks/project_components/powerful_patterns_starter/main.py @@ -0,0 +1,19 @@ +#!/bin/python3 + +from p5 import * +from random import randint + +def setup(): +# Put code to run once here + size(400, 400) + background(255, 255, 255) + + +def draw(): +# Put code to run every frame here + fill(255, 0, 255) + rect(50, 50, 120, 100) + + +# Keep this to run your code +run() diff --git a/lib/tasks/project_components/powerful_patterns_starter/project_config.yml b/lib/tasks/project_components/powerful_patterns_starter/project_config.yml new file mode 100644 index 000000000..9644645b2 --- /dev/null +++ b/lib/tasks/project_components/powerful_patterns_starter/project_config.yml @@ -0,0 +1,8 @@ +NAME: "Powerful Patterns" +IDENTIFIER: "powerful-patterns-starter" +COMPONENTS: + - name: "main" + extension: "py" + location: "main.py" + index: 0 + default: true diff --git a/lib/tasks/project_components/powerful_patterns_yakan_weaving_example/main.py b/lib/tasks/project_components/powerful_patterns_yakan_weaving_example/main.py new file mode 100644 index 000000000..12d91ca92 --- /dev/null +++ b/lib/tasks/project_components/powerful_patterns_yakan_weaving_example/main.py @@ -0,0 +1,63 @@ +#!/bin/python3 + +from p5 import * +from math import random + +def motif(): + motif_size = 100 + + #Thread colours + ORANGE = Color(254, 96, 1) + PURPLE = Color(135, 18, 192) + YELLOW = Color(243, 200, 19) + BLUE = Color(83, 171, 176) + + # Squares + fill(ORANGE) + rect(0, 0, motif_size/2, motif_size/2) + fill(PURPLE) + rect(50, 0, motif_size/2, motif_size/2) + fill(YELLOW) + rect(0, 50, motif_size/2, motif_size/2) + fill(BLUE) + rect(50, 50, motif_size/2, motif_size/2) + fill(PURPLE) + rect(0, 0, motif_size/4, motif_size/4) + fill(ORANGE) + rect(50, 0, motif_size/4, motif_size/4) + fill(BLUE) + rect(0, 50, motif_size/4, motif_size/4) + fill(YELLOW) + rect(50, 50, motif_size/4, motif_size/4) + +def rotate_motif(): + + for shape in range(5): # row of shapes + push_matrix() # save settings + rotate(radians(45)) # turn shape 45 degrees + motif() + pop_matrix() # go back to saved settings + translate(motif_width, 0) # move horizontally + +def setup(): + size(400, 400) + background(250, 5, 94) # pink + no_stroke() + print('This is πŸ‡΅πŸ‡­ Yakan weaving ') + +def draw(): + + global motif_width + motif_width = 150 + + translate(-motif_width/2, -motif_width/2) # to start with half motifs + + if frame_count < 20: # maximum rows + for row in range(frame_count): + rotate_motif() + if row / 2 == 0: # to offset pattern on next row + translate(-motif_width * 5 + 75, 80) + else: + translate(-motif_width * 5 - 75, 80) + +run(frame_rate=3) diff --git a/lib/tasks/project_components/powerful_patterns_yakan_weaving_example/project_config.yml b/lib/tasks/project_components/powerful_patterns_yakan_weaving_example/project_config.yml new file mode 100644 index 000000000..c63596dd8 --- /dev/null +++ b/lib/tasks/project_components/powerful_patterns_yakan_weaving_example/project_config.yml @@ -0,0 +1,8 @@ +NAME: "Powerful Patterns: Yakan Weaving" +IDENTIFIER: "yakan-weaving-example" +COMPONENTS: + - name: "main" + extension: "py" + location: "main.py" + index: 0 + default: true diff --git a/lib/tasks/project_components/rocket_launch_example/main.py b/lib/tasks/project_components/rocket_launch_example/main.py new file mode 100644 index 000000000..e8637ceff --- /dev/null +++ b/lib/tasks/project_components/rocket_launch_example/main.py @@ -0,0 +1,72 @@ +#!/bin/python3 + +# Import library code +from p5 import * +from random import randint + +# Setup global variables +screen_size = 400 +rocket_y = screen_size # start at the bottom +burn = 100 # how much fuel is burned in each frame +orbit_radius = 250 +orbit_y = screen_size - orbit_radius + +# The draw_rocket function goes here +def draw_rocket(): + + global rocket_y, fuel, burn + + if fuel >= burn and rocket_y > orbit_y: # still flying + rocket_y -= 1 # move the rocket + fuel -= burn # burn fuel + print('Fuel left: ', fuel) + + no_stroke() # Turn off the stroke + + for i in range(25): # draw 25 burning exhaust ellipses + fill(255, 255 - i*10, 0) # yellow + ellipse(width/2, rocket_y + i, 8, 3) # i increases each time the loop repeats + + fill(200, 200, 200, 100) # transparent grey + for i in range(20): # draw 20 random smoke ellipses + ellipse(width/2 + randint(-5, 5), rocket_y + randint(20, 50), randint(5, 10), randint(5, 10)) + + if fuel < burn and rocket_y > orbit_y: # No more fuel and not in orbit + tint(255, 0, 0) # Failure + elif fuel < 1000 and rocket_y <= orbit_y: + tint(0, 255, 0) # Success + elif fuel >= 1000 and rocket_y <= orbit_y: + tint(255, 200, 0) # Too much fuel + + image(rocket, width/2, rocket_y, 64, 64) + no_tint() + + +# The draw_background function goes here +def draw_background(): + background(0) # short for background(0, 0, 0) - black + image(planet, width/2, height, 300, 300) # draw the image + + no_fill() # Turn off any fill + stroke(255) # Set a white stroke + stroke_weight(2) + ellipse(width/2, height, orbit_radius*2, orbit_radius*2) + + +def setup(): + # Setup your animation here + size(screen_size, screen_size) + image_mode(CENTER) + global planet, rocket + planet = load_image('planet.png') # your chosen planet + rocket = load_image('rocket.png') + + +def draw(): + # Things to do in every frame + draw_background() + draw_rocket() + + +fuel = int(input('How many kilograms of fuel do you want to use?')) +run() diff --git a/lib/tasks/project_components/rocket_launch_example/project_config.yml b/lib/tasks/project_components/rocket_launch_example/project_config.yml new file mode 100644 index 000000000..3fa9056d1 --- /dev/null +++ b/lib/tasks/project_components/rocket_launch_example/project_config.yml @@ -0,0 +1,8 @@ +NAME: "Rocket Launch Example" +IDENTIFIER: "rocket-launch-example" +COMPONENTS: + - name: "main" + extension: "py" + location: "main.py" + index: 0 + default: true diff --git a/lib/tasks/project_components/rocket_launch_starter/main.py b/lib/tasks/project_components/rocket_launch_starter/main.py new file mode 100644 index 000000000..e95dc10f9 --- /dev/null +++ b/lib/tasks/project_components/rocket_launch_starter/main.py @@ -0,0 +1,28 @@ +#!/bin/python3 + +# Import library code +from p5 import * +from random import randint + +# Setup global variables + + +# The draw_rocket function goes here + + + +# The draw_background function goes here + + + +def setup(): + # Setup your animation here + + + +def draw(): + # Things to do in every frame + + + +run() diff --git a/lib/tasks/project_components/rocket_launch_starter/project_config.yml b/lib/tasks/project_components/rocket_launch_starter/project_config.yml new file mode 100644 index 000000000..5f0b9d7c8 --- /dev/null +++ b/lib/tasks/project_components/rocket_launch_starter/project_config.yml @@ -0,0 +1,8 @@ +NAME: "Rocket Launch" +IDENTIFIER: "rocket-launch-starter" +COMPONENTS: + - name: "main" + extension: "py" + location: "main.py" + index: 0 + default: true diff --git a/lib/tasks/project_components/target_practice_example/main.py b/lib/tasks/project_components/target_practice_example/main.py index 8d0da5672..7479fe1d4 100644 --- a/lib/tasks/project_components/target_practice_example/main.py +++ b/lib/tasks/project_components/target_practice_example/main.py @@ -27,18 +27,16 @@ def shoot_arrow(): def setup(): # Setup your game here size(400, 400) # width and height - frame_rate(2) - def draw(): # Things to do in every frame global outer, inner, bullseye - sky = color(92, 204, 206) # Red = 92, Green = 204, Blue = 206 - grass = color(149, 212, 122) - wood = color(145, 96, 51) - outer = color(0, 120, 180) - inner = color(210, 60, 60) - bullseye = color(220, 200, 0) + sky = Color(92, 204, 206) # Red = 92, Green = 204, Blue = 206 + grass = Color(149, 212, 122) + wood = Color(145, 96, 51) + outer = Color(0, 120, 180) + inner = Color(210, 60, 60) + bullseye = Color(220, 200, 0) no_stroke() fill(sky) @@ -58,4 +56,4 @@ def draw(): fill(wood) shoot_arrow() # Keep this to run your code -run() +run(frame_rate=2)