Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added de-DE/code/starter/background.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 18 additions & 0 deletions de-DE/code/starter/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
from p5 import *

x = 200 # horizontal middle
y = 200 # vertical middle
speed = 0
gravity = 1
jumping = False

def setup():
size(400, 400)
no_stroke()


def draw():

# Draw Frog here

run()
4 changes: 4 additions & 0 deletions de-DE/code/starter/project_config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
name: "Python wild - Hop the frog"
identifier: "python-wild-hop-the-frog"
type: python
build: true
Binary file added de-DE/images/banner.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added de-DE/images/step_1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added de-DE/images/step_2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added de-DE/images/step_3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added de-DE/images/step_4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added de-DE/images/step_5.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added de-DE/images/step_6.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added de-DE/images/step_7.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added de-DE/images/step_8.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
23 changes: 23 additions & 0 deletions de-DE/meta.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
title: Python wild - Hop the frog
hero_image: images/banner.png
description: Make a cartoon frog that jumps, stretches, and squashes as it hops through your code.
meta_title: Learn to code with Python Wild | Hop the Frog
meta_description: Learn Python with the Raspberry Pi Foundation. Code a cartoon frog that hops and stretches with animation.
version: 1
listed: true
copyedit: false
last_tested: "2025-04-11"
steps:
- title: step_1
- title: step_2
completion:
- engaged
- title: step_3
- title: step_4
- title: step_5
- title: step_6
- title: step_7
- title: step_8
completion:
- internal
- external
92 changes: 92 additions & 0 deletions de-DE/resources/dataframe.json

Large diffs are not rendered by default.

32 changes: 32 additions & 0 deletions de-DE/resources/mentor.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Mentor Notes: Python wild - Hop the frog

## Project Overview

In this Python Wild project, learners use the p5 library to build a cartoon frog that hops into the air and stretches mid-jump. They practise drawing, animation, and interactive behaviours using Python code.

---

## What Learners Will Practise

- Drawing with `ellipse()` and `circle()`
- Using variables to animate motion
- Handling mouse input with `mouse_pressed()`
- Stretching and squashing shapes with logic
- Coordinating motion with gravity and state tracking

---

## Teaching Tips

- Reinforce that `draw()` runs like a loop — it repeats automatically
- Use simple language for motion and animation (e.g. “gravity pulls the frog down”)
- Emphasise that `x` and `y` are reused for positioning every part of the frog
- Explain that `stretch` is used to change multiple shapes with one variable

---

## Extension Ideas

- Add a bug to catch with the tongue
- Give the frog a crown, cheeks, or animated arms
- Add lily pads or water splashes in the background
51 changes: 51 additions & 0 deletions de-DE/solutions/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
from p5 import *

x = 200 # horizontal middle
y = 200 # vertical middle
speed = 0
gravity = 1
jumping = False

def mouse_pressed():
global jumping, speed
if not jumping:
jumping = True
speed = -15

def setup():
size(400, 400)
no_stroke()
global bg
bg = load_image('background.png')

def draw():
global y, speed, jumping
image(bg, 0, 0, width, height)

stretch = 30 if jumping else 0

fill('green')
ellipse(x, y, 100, 80 + stretch) # body
ellipse(x - 30, y + 30, 30, 20 + stretch * 3) # left foot
ellipse(x + 30, y + 30, 30, 20 + stretch * 3) # right foot

fill('white')
circle(x - 20, y - 40 + stretch / 2, 25) # left eye
circle(x + 20, y - 40 + stretch / 2, 25) # right eye

fill('black')
circle(x - 20, y - 40 + stretch / 2, 10) # left pupil
circle(x + 20, y - 40 + stretch / 2, 10) # right pupil

fill('red')
ellipse(x, y + 20, 10, 30 - stretch / 2) # tongue

if jumping:
y += speed
speed += gravity
if y >= 200:
y = 200
speed = 0
jumping = False

run()
76 changes: 76 additions & 0 deletions de-DE/step_1.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
<h2 class="c-project-heading--task">Add a background</h2>

\--- task ---

Add an image that fills the screen with a pond background. 🐸🌿

\--- /task ---

<h2 class="c-project-heading--explainer">Set the scene</h2>

Let’s start by adding a pond background to your screen.
You’ll use `load_image()` to load a picture and `image()` to draw it each frame.

The image is already provided and saved as **`background.png`** in the same folder as your code.

<div class="c-project-code">
--- code ---
---
language: python
filename: main.py
line_numbers: true
line_number_start: 1
line_highlights: 12-13, 17
---

from p5 import \*

x = 200 # horizontal middle
y = 200 # vertical middle
speed = 0
gravity = 1
jumping = False

def setup():
size(400, 400)
no_stroke()
global bg
bg = load_image('background.png')

def draw():
image(bg, 0, 0, width, height)

```
# Draw Frog here
```

run()

\--- /code ---

</div>

<div class="c-project-output">
![A full-screen pond background](images/step_1.png)
</div>

<div class="c-project-callout c-project-callout--tip">

### More

The `image()` function places the image at a position. <br />
To fill the screen, pass in `0, 0, width, height`.

</div>

<div class="c-project-callout c-project-callout--debug">

### Debugging

If the background doesn’t appear:<br />

- `global bg` needs to be in the `setup()` function.<br />
- Make sure 'background.png' is in quotes.<br />
- Use `image(bg, 0, 0, width, height)` in `draw()`

</div>
60 changes: 60 additions & 0 deletions de-DE/step_2.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
<h2 class="c-project-heading--task">Draw the frog</h2>

\--- task ---

Use ellipses to draw the frog’s body and legs. 🐸🦵

\--- /task ---

<h2 class="c-project-heading--explainer">Draw the body and legs</h2>

Your frog needs a body and legs!
You’ll use `ellipse()` to draw ovals. 🥚

The `ellipse()` function takes **4 arguments**:

- x position
- y position
- width
- height

Each part of the frog is placed **relative to `x` and `y`**.
This will make it easy to animate later on.

<div class="c-project-code">
--- code ---
---
language: python
filename: main.py
line_numbers: true
line_number_start: 16
line_highlights: 20-23
---

def draw():
image(bg, 0, 0, width, height)

```
# Draw Frog here
fill('green')
ellipse(x, y, 100, 80) # body
ellipse(x - 30, y + 30, 30, 20) # left leg
ellipse(x + 30, y + 30, 30, 20) # right leg
```

\--- /code ---

</div>

<div class="c-project-output">
![A green frog body and feet sitting on a lily pad](images/step_2.png)
</div>

<div class="c-project-callout c-project-callout--tip">

### Tip

Try changing the numbers to see how the shapes move! <br />
Notice how each part is drawn **after** the background — otherwise it would be hidden.

</div>
74 changes: 74 additions & 0 deletions de-DE/step_3.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
<h2 class="c-project-heading--task">Draw the eyes and tongue</h2>

\--- task ---

Add white eyes with black pupils, and a red tongue underneath the frog.

\--- /task ---

<h2 class="c-project-heading--explainer">Add some character</h2>

Let’s make your frog more expressive by adding two white eyes, black pupils, and a red tongue. 👀👅

Use `circle(x, y, size)` for the eyes and pupils — circles are just a simpler version of ellipses.

<div class="c-project-code">
--- code ---
---
language: python
filename: main.py
line_numbers: true
line_number_start: 16
line_highlights: 25-27, 29-31, 33-34
---

def draw():
image(bg, 0, 0, width, height)
\# Draw Frog here

```
fill('green')
ellipse(x, y, 100, 80) # body
ellipse(x - 30, y + 30, 30, 20) # left leg
ellipse(x + 30, y + 30, 30, 20) # right leg

fill('white')
circle(x - 20, y - 40, 25) # left eye
circle(x + 20, y - 40, 25) # right eye

fill('black')
circle(x - 20, y - 40, 10) # left pupil
circle(x + 20, y - 40, 10) # right pupil

fill('red')
ellipse(x, y + 20, 10, 30) # tongue
```

\--- /code ---

</div>

<div class="c-project-output">
![A cartoon frog with white eyes, black pupils, and a red tongue](images/step_3.png)
</div>

<div class="c-project-callout c-project-callout--tip">

### Tip

Try changing the size of the eyes or tongue! <br />
What happens if you move the pupils closer together or further apart?

</div>

<div class="c-project-callout c-project-callout--debug">

### Debugging

If your eyes or tongue aren’t showing:<br />

- Make sure each shape has the right number of values<br />
- Use `fill()` before drawing each part<br />
- Check for typos in `circle()` and `ellipse()`

</div>
Loading