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:
when green flag clicked
hide
forever
switch costume to [(pick random (1) to (however many types of enemies you have)) v]
set [enemy health v] to ((costume #) * (5))
create clone of [myself v]
wait (pick random (1) to (3)) secs
end
when I start as a clone
forever
point towards [Player v]
move (5) steps
if <touching [Bullet v] ?> then
change [enemy health v] by (-3)
end
if <(enemy health) < [0]> then
delete this clone
end
end
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:
when green flag clicked
set [Health v] to [10]
show
go to x: (0) y: (0)
point towards [90 v]
forever
if <key [right arrow v] pressed?> then
change x by (10)
end
if <key [left arrow v] pressed?> then
change x by (-10)
end
if <key [up arrow v] pressed?> then
change y by (10)
end
if <key [down arrow v] pressed?> then
change y by (-10)
end
end
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:
when green flag clicked
forever
go to [Player v]
point in direction ([direction v] of [Player v])
if <<key [space v] pressed?> or <mouse down?>> then
create clone of [Bullet v]
wait (1) secs
end
end
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:
when green flag clicked
hide
when I start as a clone
show
repeat until <<touching [enemies v] ?> or <touching [edge v] ?>>
move (6) steps

end
wait (0) secs
delete this clone
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