Discuss Scratch

jlk_coder
Scratcher
84 posts

Space Shooter Game

I put this scipt in my game.
I want the lasers to shoot at the butterfly (enemy) and stop there. The code only works for one enemy and not the rest, this is the script
when green flag clicked
forever
if <> then
<touching [enemy<<> or <>><touching [enemy2<<> or <>><touching [enemy3 v] ?> v] ?> v]
delete this clone
Imakegamesalot
Scratcher
53 posts

Space Shooter Game

could you share the link to the project? Also, if the enemies are clones then I usually just put
If <touching color (  ::pen)>::control
do some cool stuff::looks
end
With the color as the outline of the enemy.
I bet it still should work with what you're trying to do but this works too
gamer_3000123
Scratcher
21 posts

Space Shooter Game

I don't know if this helps, but I know how to shoot by clicking a key like space. First make a sprite for the projectile. A rectangle will do fine. Next, put this code:


For the shooting mechanic, use this for the projectile to spawn by pressing a key for the ship:

when green flag clicked
forever
if <key [ v] pressed?> then
creat clone of [laser]
end
end

For the projectile movement though, heres the code for the laser:
when green flag clicked
hide


when I start as clone
go [forward v] (90) layers
show
go to [ ship]
point in direction ( [direction] of [ship])
move (25) steps
repeat until <touching [ enemy] ?>
move (15) steps
end
delete this clone

also for some reason scratch decides some blocks don't exist, even though they do, and some blocks are separated.
_____________________________________________________________________________________________________________________________Ihatebrainrotalsothisismysignature

Last edited by gamer_3000123 (Nov. 7, 2024 00:41:29)

Powered by DjangoBB