Lesson 4: Projectiles + Power-Ups
Grades 3โ€“5

Learning Targets

  • Create projectile attacks using cloning and movement
  • Add cooldowns so players canโ€™t spam attacks
  • Spawn power-ups that change speed or heal HP

Materials

  • Scratch

Step 1: Projectile Sprite

  1. Create a new sprite named Projectile (small circle).
  2. Hide the original. Use clones for each shot.
// Projectile sprite
when green flag clicked
hide

define fire (startX) (startY) (direction)
go to x: (startX) y: (startY)
point in direction (direction)
create clone of [myself v]

when I start as a clone
show
repeat until <touching [edge v]?>
  move (12) steps
  if <touching [Opponent v]?> then
    change [Opponent HP v] by (-10)
    delete this clone
  end
end
delete this clone

Step 2: Fire Controls + Cooldown

In the Bear sprite, press H to shoot right; in Opponent sprite, press ; to shoot left.

// Bear sprite
when green flag clicked
set [canShoot v] to [true]
forever
  if <<key [h v] pressed?> and <(canShoot) = [true]>> then
    set [canShoot v] to [false]
    broadcast [bear-fire v]
    wait (0.5) seconds // cooldown
    set [canShoot v] to [true]
  end
end

when I receive [bear-fire v]
call fire ((x position)) ((y position)) (90) // from Projectile
// Opponent sprite
when green flag clicked
set [canShoot v] to [true]
forever
  if <<key [; v] pressed?> and <(canShoot) = [true]>> then
    set [canShoot v] to [false]
    broadcast [opponent-fire v]
    wait (0.5) seconds // cooldown
    set [canShoot v] to [true]
  end
end

when I receive [opponent-fire v]
call fire ((x position)) ((y position)) (-90) // from Projectile

Tip: In the Projectile sprite, right-click the fire custom block and check โ€œRun without screen refreshโ€ for smoother motion.

Step 3: Power-Ups (Speed + Heal)

  1. Create a sprite named PowerUp with two costumes: speed and heart.
  2. Randomly show one at a random spot every 10 seconds.
// PowerUp sprite
when green flag clicked
forever
  wait (10) seconds
  go to x: (pick random (-200) to (200)) y: (pick random (-120) to (120))
  switch costume to (pick random (1) to (2))
  show
  wait until <<touching [Bear v]?> or <touching [Opponent v]?>>
  if <touching [Bear v]?> then
    if <(costume #) = (1)> then // speed
      change [bearSpeed v] by (3)
      wait (5) seconds
      change [bearSpeed v] by (-3)
    else // heart
      change [Bear HP v] by (15)
    end
  else // Opponent got it
    if <(costume #) = (1)> then // speed
      change [opponentSpeed v] by (3)
      wait (5) seconds
      change [opponentSpeed v] by (-3)
    else // heart
      change [Opponent HP v] by (15)
    end
  end
  hide
end

Use bearSpeed and opponentSpeed variables inside your movement code to adjust speed.

Step 4: Balance + Polish

  • Adjust cooldowns (0.3โ€“0.8s) and damage (5โ€“15) for fairness
  • Limit the number of active projectiles (e.g., 2 on-screen)
  • Add brief animations or sounds when firing or picking a power-up

Review

  1. How does cloning help with projectiles?
  2. Why add a cooldown?
  3. What balance changes made your game more fun?