Discuss Scratch

MechanicalGamer1
Scratcher
19 posts

Scratch space shooter

Hey! I want to make it so that the game asks the user how many enemies should spawn in each level of the game (its a simple space shooter the enemies go from top to bottom). I am having some issues coding it in so that each of the 3 types of enemies I made all spawn a number of times that add up to the input given by the user. (The game asks about total number of enemies spawned)
LittleGreyCells
Scratch Team
1000+ posts

Scratch space shooter

Moved to Help With Scripts
MechanicalGamer1
Scratcher
19 posts

Scratch space shooter

what do you mean mod squad?

broskinumber3
Scratcher
41 posts

Scratch space shooter

MechanicalGamer1 wrote:

Hey! I want to make it so that the game asks the user how many enemies should spawn in each level of the game (its a simple space shooter the enemies go from top to bottom). I am having some issues coding it in so that each of the 3 types of enemies I made all spawn a number of times that add up to the input given by the user. (The game asks about total number of enemies spawned)

can you send the project?
also you should just divide the answer by 3 and spawn in the corresponding enemies from there

example
if the user inputs 30, divide it by 3

spawn in 10 of type1
10 of type2
10 of type3

and the division by 3 wont always leave you with a whole number, so also add a round() block around it
MechanicalGamer1
Scratcher
19 posts

Scratch space shooter

Already did that, round block around what? I dont know how the round block works. Are you able to open this?Your text to link here… The issue is that the game is like the enemies are dropping from top to bottom. Should I do this using clones?
Rafael_Bagi123
Scratcher
86 posts

Scratch space shooter

MechanicalGamer1 wrote:

Already did that, round block around what? I dont know how the round block works. Are you able to open this?Your text to link here… The issue is that the game is like the enemies are dropping from top to bottom. Should I do this using clones?


the project is not shared…
and the answer for your question is yes, you should be using clones
so here is my solution (inspired inbroskinumber3 solution):
do this code:

when green flag clicked
ask [how many enemies you want?] and wait
repeat (round ((answer) / (3)))
switch costume to [enemy 1]
create clone of [myself]

end
repeat (round ((answer) / (3)))
switch costume to [enemy 2]
create clone of [myself]


end
repeat (round ((answer) / (3)))
switch costume to [enemy 2]
create clone of [myself]




end

i hope that help

Last edited by Rafael_Bagi123 (Nov. 12, 2023 22:49:20)

MechanicalGamer1
Scratcher
19 posts

Scratch space shooter

The game also asks the user how many points you should get by killing each of the 3 enemies. So I made each of the 3 enemies a a different sprite. The game also asks the user how many enemies there should be per round for round 1 , 2 , 3 , 4. The answers get saved in a list, like the first item of the list is how many enemies there should in round 1. Can you please help me with that?
MechanicalGamer1
Scratcher
19 posts

Scratch space shooter

Like how can I use the values in the list to spawn the enemies the number of specified times. And yes I got the round divide by 3 thing

Powered by DjangoBB