Discuss Scratch

Eerolmckin
New to Scratch
1 post

How to make a sprite disappear after touching a projectile

So, I am making a game for my school project, and I've got a working code but for some reason whenever the projectile hits the intended target or edge, it won't disappear. Also im trying to make the sprite move whenever I press WASD or arrow keys.
KangaCoder
Scratcher
1000+ posts

How to make a sprite disappear after touching a projectile

On Sprite1 (whatever the target is):
when green flag clicked
forever
if <touching [projectile] ?> then
hide


else
show
end
end

To make the sprite move:
when green flag clicked
forever
if <<key [up arrow] pressed?> or <key [w] pressed?>> then
change y by (...)



end
if <<key [down arrow] pressed?> or <key [s] pressed?>> then
change y by (...)



end
if <<key [right arrow] pressed?> or <key [d] pressed?>> then
change x by (...)



end
if <<key [left arrow] pressed?> or <key [a] pressed?>> then
change x by (...)



end
end

Last edited by KangaCoder (Sept. 27, 2021 21:21:24)


don't feed the trolls. feed yourself pizza cupcakez .[1] [2] [3] [4]









KangaCoder • [he/him] • kæŋɡəˈ koʊdər

Random Fun Facts: Male, Christian, US resident, EST time zone, Ravenclaw, likes Math and Science, learning German, knows HTML, Python and Java, loves chocolate, favorite color, possibly a kangaroo
On the Main Site: Experienced Wikian, Camp Counselor, SWC Reviewer, SDS Helper, Forum Helper
On the Forums: 2.65K+ forum posts
Project Ideas Directory 6.0 - need a project idea? Check it out!
Check out some weird and cool Scratch pages!
ItsMe-XTV-
Scratcher
100+ posts

How to make a sprite disappear after touching a projectile

forever
if <touching [ said bullet sprite] ?> then
hide
end
end

Edit: ninja’d.

Last edited by ItsMe-XTV- (Sept. 27, 2021 21:19:23)


SUSSYIMPOSTAER
Scratcher
38 posts

How to make a sprite disappear after touching a projectile

belonges in help with scripts

whatchu know bout rollin down in da deep
Jhisle
Scratcher
53 posts

How to make a sprite disappear after touching a projectile


Sorry for the bad siggy

SUSSYIMPOSTAER
Scratcher
38 posts

How to make a sprite disappear after touching a projectile

Jhisle wrote:

why did u post literally nothing

whatchu know bout rollin down in da deep
Jhisle
Scratcher
53 posts

How to make a sprite disappear after touching a projectile

SUSSYIMPOSTAER wrote:

Jhisle wrote:

why did u post literally nothing
(list :: list)(list :: list)(list :: list)(list :: list)(list :: list)(list :: list)(list :: list)(list :: list)(list :: list)

Sorry for the bad siggy

SUSSYIMPOSTAER
Scratcher
38 posts

How to make a sprite disappear after touching a projectile

Jhisle wrote:

SUSSYIMPOSTAER wrote:

Jhisle wrote:

why did u post literally nothing
(list :: list)(list :: list)(list :: list)(list :: list)(list :: list)(list :: list)(list :: list)(list :: list)(list :: list)
bro stop spamming

whatchu know bout rollin down in da deep
SUSSYIMPOSTAER
Scratcher
38 posts

How to make a sprite disappear after touching a projectile

Jhisle wrote:

bro this message empty like my reasons to live dont post stuff like this

whatchu know bout rollin down in da deep
LG125
Scratcher
500+ posts

How to make a sprite disappear after touching a projectile

SUSSYIMPOSTAER wrote:

Jhisle wrote:

bro this message empty like my reasons to live dont post stuff like this
And please don’t reply to the same thing 2 times if you could just edit the original message.

Also jhistle please don’t spam.



Cheespeasa1234
Scratcher
57 posts

How to make a sprite disappear after touching a projectile

wangat wrote:

On Sprite1 (whatever the target is):
when green flag clicked
forever
if <touching [projectile] ?> then
hide


else
show
end
end

To make the sprite move:
when green flag clicked
forever
if <<key [up arrow] pressed?> or <key [w] pressed?>> then
change y by (...)



end
if <<key [down arrow] pressed?> or <key [s] pressed?>> then
change y by (...)



end
if <<key [right arrow] pressed?> or <key [d] pressed?>> then
change x by (...)



end
if <<key [left arrow] pressed?> or <key [a] pressed?>> then
change x by (...)



end
end

That isn't going to work. The sprite will reappear after the projectile isn't touching anymore. Remove the else, and it should work.

Void Gunner Released Today!
Try it out here - https://scratch.mit.edu/projects/579041372
——————–
when flag clicked
if <(covidExists?) = [true]> then
forever
if <(distance) < [6]> then
turn cw (180) degrees
repeat until <not <(distance) < [6]>>
move (1) steps
end
end
end

Powered by DjangoBB