Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » How to make a sprite shoot something ???
- SuperSonicmario
-
Scratcher
100+ posts
How to make a sprite shoot something ???
when this sprite clicked //or any other hat block (put this in the character sprite)Hope this helps
broadcast [shoot v]
when I receive [shoot v] //put this in the projectile sprite
show
glide (2) secs to x: ([x position v] of [Enemy v]) y: ([y position v] of [Enemy v]
hide
broadcast [enemy shot v]
when I receive [enemy shot v] //put this and all other scripts below in enemy sprite
hide
when gf clicked //put in enemy sprite and projectile sprite
show

- deck26
-
Scratcher
1000+ posts
How to make a sprite shoot something ???
If you only want one bullet/missile on screen at a time you can use a sprite. If you want more than one you probably want to use clones with a new clone being made each time the firing action happens (and the clone being deleted once it hits something or reaches the edge of the screen). The overall method is the same. I haven't done it in Scratch blocks but you can probably work it out.
assuming missile is hidden initially
go to firing sprite
point in right direction (may be mouse controlled, may just be direction of firing sprite or other method)
show missile
move missile in a loop until it hits something or reaches the edge
object being hit probably detects the hit and acts accordingly
hide missile
You probably don't want to glide to the enemy's position and assume you've made a hit - what if the enemy moves?
assuming missile is hidden initially
go to firing sprite
point in right direction (may be mouse controlled, may just be direction of firing sprite or other method)
show missile
move missile in a loop until it hits something or reaches the edge
object being hit probably detects the hit and acts accordingly
hide missile
You probably don't want to glide to the enemy's position and assume you've made a hit - what if the enemy moves?
- sugarcrasherz
-
Scratcher
3 posts
How to make a sprite shoot something ???
i am having trouble with the same thing. I am making a crab shooting a fish (fish gets faster on each level) i need to make the crab shoot but i dont know how so please help me
- deck26
-
Scratcher
1000+ posts
How to make a sprite shoot something ???
i am having trouble with the same thing. I am making a crab shooting a fish (fish gets faster on each level) i need to make the crab shoot but i dont know how so please help mePlease start your own topic.
- sugarcrasherz
-
Scratcher
3 posts
How to make a sprite shoot something ???
what do you mean start my own topici am having trouble with the same thing. I am making a crab shooting a fish (fish gets faster on each level) i need to make the crab shoot but i dont know how so please help mePlease start your own topic.
- Milk2365
-
Scratcher
34 posts
How to make a sprite shoot something ???
You can clone and glide the clone
- sugarcrasherz
-
Scratcher
3 posts
How to make a sprite shoot something ???
You can clone and glide the clonewell the problem with dat is when it glides you set it with coordinates so every time you shoot it will go to the same place
- Dominos101
-
Scratcher
1 post
How to make a sprite shoot something ???
say []
stop all sounds
pen up
when this sprite clicked
if <key [ v] pressed?> then
end
- Arisandra
-
Scratcher
100+ posts
How to make a sprite shoot something ???
Here's a great tutorial with these things and other useful info (Australian GGSP): http://www.abc.net.au/abc3/goodgamesp/tutorials/ (has got multiple parts)
- smartguy19
-
Scratcher
4 posts
How to make a sprite shoot something ???
say [i dont know notin bout this
] for (2) secs
- PikaPal54
-
Scratcher
100+ posts
How to make a sprite shoot something ???
Please don't necropost (posting on an old topic). The last post here was over 2 months ago.
- Discussion Forums
- » Help with Scripts
-
» How to make a sprite shoot something ???
