Adding characters to a 2-player battle in Scratch means creating new sprite costumes or duplicating existing sprites, then linking them to your game controls
The simplest way is to duplicate your current character sprite, give it a different costume, and assign it new keyboard controls. If you want more variety, you can import new sprites from Scratch's library or draw your own. The key is making sure each character has its own set of scripts that respond to different keys — one player might use arrow keys while another uses WASD or different arrow keys entirely.
Most 2-player battle games in Scratch start with one sprite controlled by one set of keys. To expand that, you either add more costumes to the same sprite and switch between them, or you create separate sprites for each character option. The second approach is cleaner because each sprite can have completely independent scripts and behavior.
Key Takeaways
- Duplicate your existing character sprite in the Sprites panel, then assign it new keyboard controls to create a second playable character.
- Each character sprite needs its own script that listens for different keys — typically one player uses arrow keys and the other uses WASD or number keys.
- You can add character variety by importing sprites from Scratch's library, drawing new costumes, or uploading images you create elsewhere.
- Test each character's movement and attacks separately before running the full game to catch control conflicts early.
- Store character stats like health and position in variables specific to each sprite so they do not interfere with each other.
Duplicating a sprite to create a second character
Right-click on your character sprite in the Sprites panel on the left side of the Scratch editor. Select "Duplicate" from the menu. Scratch creates an exact copy with the same scripts, costumes, and variables. Rename it when ready — click the sprite name and change it to something like "Player2" or "Character2" so you can tell them apart in your code.
Now you have two identical sprites. The problem is they respond to the same keys, so they move together. You need to change the keyboard controls on the second sprite. Open the scripts for Player2 and find the block that says when [key] pressed. Click the dropdown and change it from the original key (like "up arrow") to a different key. If Player1 uses arrow keys, give Player2 the W, A, S, D keys or number keys instead.
Make sure the movement direction is correct for each key. If Player1 moves right when the right arrow is pressed, Player2 should move right when D is pressed. Test both characters separately by pressing their keys and watching them move on the stage.
Assigning different keyboard controls to each player
Open the scripts for your first character sprite. Look for the when [key] pressed blocks. These are usually in a stack that handles movement. Common setups use arrow keys for one player and WASD for the other, or arrow keys for Player1 and number keys (2, 4, 6, 8) for Player2.
For Player1, your blocks might look like: "when up arrow pressed, change y by 10" and "when down arrow pressed, change y by -10". For Player2, replace those with "when W pressed, change y by 10" and "when S pressed, change y by -10". The movement logic stays the same; only the trigger key changes.
If your game includes attacks or special moves, assign those to different keys too. Player1 might press space to attack while Player2 presses Enter. Write down your control scheme on paper before you code it — this prevents confusion and makes testing faster.
Importing new character sprites from the Scratch library
Click the button that says "Choose a Sprite" at the bottom of the Sprites panel. A menu opens showing categories like Animals, People, Fantasy, and Sports. Browse the library and click on a sprite you want to add. Scratch imports it as a new sprite in your project.
The imported sprite comes with its own costumes and sometimes pre-built scripts. Delete any scripts you do not need, then add your own movement and attack code. Assign it keyboard controls different from your other characters. If the sprite is too large or small compared to your other characters, click it on the stage and use the resize handle in the corner to scale it.
You can also upload your own image as a sprite. Click "Upload Sprite" in the same menu, select an image file from your computer, and Scratch converts it to a sprite. This works well if you have drawn characters in another program or found images online that fit your game's style.
Creating separate variables for each character's stats
If your battle game tracks health, score, or position, use variables that belong to a single sprite rather than variables that explore to the whole project. In Scratch, when you create a variable, you can choose "For this sprite only" instead of "For all sprites". This means Player1's health variable does not affect Player2's health.
Create a health variable for Player1, then create a separate health variable for Player2. Name them clearly: "Player1_Health" and "Player2_Health" or just "Health" if you set each one to "for this sprite only". When Player1 takes damage, subtract from Player1's health. When Player2 takes damage, subtract from Player2's health. This prevents one character's damage from accidentally affecting the other.
The same rule applies to position, score, or any stat you track. If both characters need to know their own position, give each sprite its own position variable. This keeps the scripts straightforward and prevents bugs where one character's movement interferes with the other's.
Testing controls and fixing conflicts
Click the green flag to start your game and test Player1's controls first. Press each key and watch the character move or attack. Make sure the movement feels responsive and the direction matches the key. Then test Player2's controls the same way. Press both sets of keys and make sure they do not interfere — Player1 should not move when you press Player2's keys.
If both players move at the same time when you press one key, you have a control conflict. Check that each sprite has its own when [key] pressed blocks with different keys. If one sprite is responding to the other's keys, you may have accidentally left code on the wrong sprite. Open each sprite's scripts and verify the keys are different.
Test the full battle: both players moving, attacking, and taking damage at the same time. Watch for lag or freezing, which usually means your scripts are too complex or running too many loops. Simplify if needed. Once both players control smoothly and independently, your 2-player battle is ready for more features.
Adding more than two characters to choose from
Create a character selection screen before the battle starts. Add a sprite that displays character portraits or names. When a player presses a key, hide the current character sprite and show a different one. For example, pressing 1 might show Character A, pressing 2 shows Character B, and pressing 3 shows Character C.
Use a variable called "Player1_Character" that stores which character is selected. Set it to 1, 2, or 3 depending on the key pressed. Then use if blocks to show or hide sprites based on that variable. This way, players can pick their character before the battle begins, and only the selected character appears on the stage.
Each selectable character should be its own sprite with its own scripts and costumes. This keeps your project organized and makes it straightforward to add more characters later. You can also give each character different stats — one might be fast but weak, another slow but strong — by changing the values in their movement and damage scripts.
Frequently Asked Questions
Can I use the same sprite for both players with different costumes?
Yes, but it is harder to manage. You would need to track which costume each player is wearing and switch costumes constantly during the game. It is simpler to duplicate the sprite so each player has their own sprite object with independent scripts. That way, Player1 and Player2 can have different costumes without you having to switch them manually.
What if my characters are different sizes?
Click each sprite on the stage and use the resize handle in the corner to scale it up or down. You can also use the set size to block in scripts to resize a sprite when it is created. If one character is much larger than the other, it can look unfair in a battle game, so try to make them roughly the same size visually.
How do I make one character stronger or faster than another?
Change the numbers in their movement and attack scripts. If Player1 moves 10 pixels per key press and Player2 moves 8 pixels, Player1 is faster. If Player1's attack deals 5 damage and Player2's deals 3 damage, Player1 is stronger. Adjust these numbers until the game feels balanced, or intentionally make one character stronger if that fits your game design.
Can I add a third player?
Yes. Duplicate your second character sprite, rename it Player3, and assign it a third set of keyboard controls — for example, the number pad keys or IJKL. Make sure Player3 has its own health variable and attack scripts. Test all three players together to make sure their controls do not overlap.
What happens if two players press their keys at the exact same time?
Scratch processes both key presses in the same frame, so both characters move or attack simultaneously. This is the correct behavior for a 2-player game. If you want one player's action to happen before the other's, you would need to add a turn-based system with variables that track whose turn it is, which is more advanced.