Discuss Scratch

TheBlubStudios
Scratcher
100+ posts

How to make a shooter game?

I want to make a Halloween themed shooter game but idk hiw
EggDOG_MyNAME--Jeff
Scratcher
100+ posts

How to make a shooter game?

Well, here's one way to do it:

Make a sprite called “Enemies.” Then, in this sprite, draw whatever enemies you want to be in your game. For example, you may want a zombie, a bat, and a vampire. For this, you'd make a costume for each. Make a variable for this sprite only called “enemy health.” Then, put this code:
whenclickedhideforeverswitchcostumeto(pick random (1) to (however many types of enemies you have))setenemy healthtocostume#*5createcloneofmyselfwaitpickrandom1to3secswhenIstartasacloneforeverpointtowardsPlayermove5stepsiftouchingBullet?thenchangeenemy healthby-3ifenemyhealth<0thendeletethisclone
Keep in mind, the wait block doesn't have to be a pick random; just make it however long you want the game to wait before creating a new enemy. Also, you can customize how fast the enemy is by changing the value of the ‘move 5 steps’ block. The ‘change enemy health by -3’ block is how much damage the player does to the enemies. You can customize this, but just make sure to put a minus sign infront of any value you put in that block, or else will give the enemy health instead of taking it away.
Now, make a sprite called “Player.” Draw the player in one costume. Then, make a variable for all sprites named “Health,” and then put the following code:
whenclickedsetHealthto10showgotox:0y:0pointtowards90foreverifkeyright arrowpressed?thenchangexby10ifkeyleft arrowpressed?thenchangexby-10ifkeyup arrowpressed?thenchangeyby10ifkeydown arrowpressed?thenchangeyby-10
After you've done this, make a new sprite named “Weapon.” This can be a gun, or anything else that shoots projectiles. But when you draw it's costume, make sure to make it point to the right, or the game will not work. Make everything you draw in your game point to the right, or else it will not work. You will also want to make another sprite called “Bullet.” In the gun sprite, put the following code:
whenclickedforevergotoPlayerpointindirectiondirectionofPlayerifkeyspacepressed?ormousedown?thencreatecloneofBulletwait1secs
The ‘wait 1 seconds’ block will be the cooldown on shooting. You can customize it to your liking. You can also just make the player shoot if the mouse is down, and not if the spacebar is pressed, and vice versa. Now, in the bullet sprite, put these scripts:
whenclickedhidewhenIstartasacloneshowrepeatuntiltouchingenemies?ortouchingedge?move6stepswait0secsdeletethisclone
The ‘move 6 steps’ block is just how fast the bullet will move. You can customize this. But at the end, you MUST put the ‘wait 0 seconds’ block, or else the game will not work. That is it! You now can customize your game and make it look however you want it to.

Last edited by EggDOG_MyNAME--Jeff (Oct. 23, 2022 22:34:55)

TheBlubStudios
Scratcher
100+ posts

How to make a shooter game?

Thanks
EggDOG_MyNAME--Jeff
Scratcher
100+ posts

How to make a shooter game?

Wait, it's not finished.I'm editing it now.
notc00lguy
Scratcher
13 posts

How to make a shooter game?

Thanks for the motivation message
TheBlubStudios
Scratcher
100+ posts

How to make a shooter game?

thank you!
TheBlubStudios
Scratcher
100+ posts

How to make a shooter game?

EggDOG_MyNAME--Jeff
Scratcher
100+ posts

How to make a shooter game?

TheBlubStudios wrote:

https://scratch.mit.edu/projects/750069216
Nice game! However, I thought you were making more of a top down shooter lol.
If I'd known the type of game you wanted to make, I could've given you more fitting code. But I guess it all worked out in the end!

Last edited by EggDOG_MyNAME--Jeff (Oct. 24, 2022 04:41:41)

Powered by DjangoBB