Here's a Python script that creates a simple terminal-based animation of Pikachu running using ASCII art. The animation cycles through two frames to simulate movement, and it runs continuously in the terminal.
✅ Features:
- Uses basic ASCII art to represent Pikachu.
- Smoothly cycles through two frames.
- Works on both Windows and Unix systems.
- Clear screen between frames for a clean animation effect.
🧠 How It Works:
- ASCII Art Frames: Two different poses of Pikachu are defined as multi-line strings.
- Screen Clearing: The terminal is cleared before each frame is printed to avoid visual clutter.
- Timing:
time.sleep(0.5) is used to control the animation speed.
💡 Notes:
- You can expand the animation by adding more frames for a smoother effect.
- Ensure your terminal supports Unicode for proper rendering (most modern terminals do).
🧪 Full Script:
import os
import time
def clear_screen():
"""Clears the terminal screen."""
os.system('cls' if os.name == 'nt' else 'clear')
# Define the frames of the Pikachu running animation
frames = [
""" /\\
/ \\
( o o )
\\\\ /
\\""",
""" /\\
/ \\
( o o )
/ \\
\\"""
]
# Infinite loop to play the animation
try:
while True:
for frame in frames:
clear_screen()
print(frame)
time.sleep(0.5)
except KeyboardInterrupt:
print("\nAnimation stopped.")
🧪 Example Output:
When running the script, you'll see a simple running animation of Pikachu like this:
/\
/ \
( o o )
\ /
\
Then it switches to:
/\
/ \
( o o )
/ \
\
And the cycle continues.
🧩 Customization Tips:
- Add more frames to make the animation smoother.
- Adjust the
time.sleep() value to speed up or slow down the animation.
- Use more detailed ASCII art for a more realistic Pikachu.
Let me know if you'd like to add more frames or enhance the design! 🎮