Tynker Soccer Game – Step-by-Step Coding Guide

 In this project, we create a two-player Soccer Game using Tynker.

Players control their characters using the mouse, hit the soccer ball, and try to score goals.
When the ball touches a goal area, the game announces the winner and stops.



This project introduces:

  • Mouse controls

  • Collision detection

  • Direction control

  • Simple win logic

  • Sports-based game design

Suitable for Grades 4–7 and beginner coders.



 Game Objective

  • Move players by dragging them with the mouse

  • Hit the soccer ball toward the opponent’s goal

  • First player to score wins the game



 Game Elements Used

 Actors

  • Red Player (actor1)

  • Blue Player (actor)

 Game Object

  • Soccer Ball (Basketball sprite used as ball)

 Goals

  • Red Goal (left side)

  • Blue Goal (right side)

 Step-by-Step Coding Guidelines

 Step 1: Set Player Direction on Start

Code (for both players):

on start
→ point towards left edge / right edge
→ set rotation style left-right

Explanation:

  • Ensures players face the correct direction

  • Prevents upside-down rotation

  • Makes movement look realistic

 Step 2: Move Player Using Mouse Control

Code:

when actor clicked
→ repeat while mouse down?
→ go to mouse-pointer

Explanation:

  • Allows players to drag their character

  • Movement happens only while mouse button is pressed

  • Introduces interactive control

 This makes the game very intuitive for kids.

 Step 3: Animate Player When Touching the Ball

Code:

when touching Basketball occurs
→ animate Side Basketball Run Dribble

Explanation:

  • Plays a dribbling animation

  • Adds realism to the soccer movement

  • Helps students understand event-triggered animation

 Step 4: Make the Ball Move When Hit

Code (Ball Sprite):

when touching actor occurs
→ point towards left edge
→ move 100 pixels
when touching actor1 occurs
→ point towards right edge
→ move 100 pixels

Explanation:

  • Ball moves based on which player hits it

  • Direction changes dynamically

  • Simulates kicking the ball

 This introduces directional logic + physics feel

 Step 5: Detect Goal and Declare Winner

Code (Goal Area):

when touching Basketball occurs
→ say "Red wins" for 2 seconds
→ set bubble to top message box
→ stop all

Explanation:

  • When the ball touches the goal:

    • Winner message appears

    • Game stops completely

  • Clear and satisfying game ending

 How to Play the Game

  1. Click and drag a player using the mouse

  2. Hit the soccer ball

  3. Push the ball into the opponent’s goal

  4. First goal wins the match














Comments

Product Cards
Buddy Bot eBook
⭐ New 2026 Release
Build Your
Own Robot!
3D design, wiring &
Arduino coding.
Young inventors love it!
🖨️
3D Print
All parts
Wire it
Circuit guide
💻
Code it
Arduino IDE
🤖
Watch it
Walk & react
📋 Your Details
Enter your name
Valid 10-digit no.
Enter a valid email
Special Website Offer
₹499 300
🌍 International: $5 USD
One-time · Instant digital delivery
🔒 Secured by Razorpay · Your data is safe
📄 Download Free Sample Copy
🔒 Secured by Razorpay · Your data is safe
🍓
Raspberry Pi Pico Mastery
21 Projects
⚡ Launch Price — 80% OFF
Learn Pico
Build 21 Projects!
MicroPython · Wokwi
IoT · Certificate
Perfect for beginners!
🖥️
Wokwi
No hardware
🐍
MicroPy
From zero
🔨
21 Projects
IoT + sensors
📄
Certificate
Verified cert
📋 Your Details
Enter your name
Valid 10-digit no.
Enter a valid email
Special Launch Offer
₹999 200 80% OFF
🌍 International: $5 USD
One-time · Lifetime access · No subscription
🔒 Secured by Razorpay · UPI · Cards · NetBanking
🎉

You're in!

Payment successful! Your Buddy Bot eBook is ready. Time to build!

📖 Access Your eBook Now
🎉

Enrolled!

Payment successful! Lifetime access to all 21 Pico Projects is yours!

🍓 Go to My Course