0% found this document useful (0 votes)
7 views3 pages

Player Vs Computer

This document outlines the steps to create a player vs computer game using sprites in a coding environment. The player controls a sprite that can move and shoot, while the computer sprite moves automatically and also shoots. The game includes variables for player and computer lives, and conditions for winning based on the lives remaining.

Uploaded by

jefmo jeeefmo
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views3 pages

Player Vs Computer

This document outlines the steps to create a player vs computer game using sprites in a coding environment. The player controls a sprite that can move and shoot, while the computer sprite moves automatically and also shoots. The game includes variables for player and computer lives, and conditions for winning based on the lives remaining.

Uploaded by

jefmo jeeefmo
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

PLAYER VS COMPUTER

In this project you will make any sprite (I’m using Wizard girl) as Player that you can control its
move - up and down. And any sprite (I’m using Dragon) as computer that will move by itself
when we click on the green flag. The player will shoot something (I’m using lightning), if key
space pressed. And the computer also shoot something automatically (I’m using Fire). This
game have 2 variables for computer’s and player’s live. You can find the steps and instructions
how to make it down below.

1. Choose the sprite


 Choose the sprite for player and computer. Each of these sprite should be in opposite
direction. One in left another one in right side. Don’t forget to name your sprite with
player and computer
 Choose any smaller object as the shooting object ( could be fire, ball, lightning, or
anything you like.) Don’t forget to name the object.
 Then make the text sprite. This text sprite has 2 costume. Fisrt is Computer win and
second costume is Player win. Name the costume with computer for fitrst costume and
player for another one.
 So in total you will have 5 sprites.

2. Do the code

 First make the computer sprite glide 1 second to certain X and Y pick random 180 to -
180 right after you clicked the green flag. Then when the green flag clicked set computer
life to any number you like (maximum is 5, minimum is 3). Then add forever block,
inside it make condition : if touching player’s shooting object then change computer life
to -1. Notes: if you want the sprite smaller you can add <set size to> block. If you want
your sprite have special looks effect you can use <set effect to> block. And put this block
right below <when green flag klicked> block.
 Secondly make the player sprite move up by using if key up arrow pressed then change
Y by 10. And if key down arrow pressed then chane the Y by -1. When green flag clicked
set the player’s life to any number you like (maximum is 5, minimum is 3). Then add
forever block, inside it make condition : if touching computer’s shooting object then
change computer life to -1.
 After that we will make the code for player’s shooting object. The code will be start
when you click the space button. And it will go to player, repeat until touching edge or
touching computer and change x by 10. And then hide this sprite. Don’t forget to add
show block at beginning.
 Then we will make the code for computer’s shooting object. Use when green flag
clicked code to start this script. Then forever blocked to make the script inside run
continuously. Inside forever block you’ll have wait (pick random 0.1 to 0.5) second, go to
computer sprite, repeat until touching player or touching edge, show and change X by -
10. Outside the repeat until block add hide.
 The last code is for Text Sprite. This sprite will hide when you click n green flag. If
computer’s live is 0 then show and change looks to costume player win and stop all. If
player’s live is 0 then show and change looks to costume computer win and stop all.
3. Choose any backdrop you like.
4. Enjoy the game!

You might also like