Discuss Scratch

TastyFish1234
New Scratcher
6 posts

Shooting in direction

I'm trying to make it that when I press space it shoots, it works, but it only shoots in one direction, it doesn't shoot in whatever direction I am standing in
when spacekeypressedpointindirection directionof Terarepeatuntiltouching Nano?ortouching Sprite1?ortouching Sprite2?move10stepshidegoto Tera
Crimson19
Scratcher
1000+ posts

Shooting in direction

It has to point in the direction of the gun/character. Also, you have to make sure that if the gun and the character are one sprite, you set the costume center to the gun.
deck26
Scratcher
1000+ posts

Shooting in direction

Crimson19 wrote:

It has to point in the direction of the gun/character. Also, you have to make sure that if the gun and the character are one sprite, you set the costume center to the gun.
It's not necessary to set the costume centre to the gun and may not be best advice. If the gun is being held out to the side of the character this would give a flipping effect when the character turned.

The main thing is that the bullets move along the line of the gun which is easiest if the gun is pointing in the direction the sprite is pointing. Then the bullet can go to the centre of the character, point in the right direction and move x steps while still hidden. The x steps bring it to the exit point of the gun. Normal firing movement takes over from there.
thoriq12654
Scratcher
93 posts

Shooting in direction

You can try this
whenspacekeypressedgototerarepeatuntiltouchingnano?ortouchingsprite1?ortouchingsprite2?move10stepsiftouchingnano?ortouchingsprite1?ortouching sprite2?thenhidegototera
deck26
Scratcher
1000+ posts

Shooting in direction

thoriq12654 wrote:

deck26 wrote:

Crimson19 wrote:

It has to point in the direction of the gun/character. Also, you have to make sure that if the gun and the character are one sprite, you set the costume center to the gun.
It's not necessary to set the costume centre to the gun and may not be best advice. If the gun is being held out to the side of the character this would give a flipping effect when the character turned.

The main thing is that the bullets move along the line of the gun which is easiest if the gun is pointing in the direction the sprite is pointing. Then the bullet can go to the centre of the character, point in the right direction and move x steps while still hidden. The x steps bring it to the exit point of the gun. Normal firing movement takes over from there.
You Like helping people
Do You Want To join My Collab
For Studio
http://scratch.mit.edu/studios/993410/
For Recruiting
http://scratch.mit.edu/discuss/topic/94892/
My feeling is that having studios or sub-groups of Scratchers helping out somewhere else confuses the issue. If someone needs help they can come here and will get help from anyone who is currently around. If they go to a studio it is potentially much more hit and miss which might discourage them from asking for help. Multiply that by the number of different people trying to help that way and you end up with too many places where help might be available.

So I appreciate the offer but would actually rather encourage you to help out here and not do it elsewhere.

Last edited by deck26 (March 3, 2015 11:11:17)

TastyFish1234
New Scratcher
6 posts

Shooting in direction

Crimson19 wrote:

It has to point in the direction of the gun/character. Also, you have to make sure that if the gun and the character are one sprite, you set the costume center to the gun.
It does not have a weapon, it shoots from it's mouth
deck26
Scratcher
1000+ posts

Shooting in direction

TastyFish1234 wrote:

Crimson19 wrote:

It has to point in the direction of the gun/character. Also, you have to make sure that if the gun and the character are one sprite, you set the costume center to the gun.
It does not have a weapon, it shoots from it's mouth
That doesn't exactly make much difference to the overall idea of the advice you've received.

However looking at your original post you probably don't want the ‘go to Tera’ in the ‘repeat until’ - that may just be an error in your use of scratchblocks though.

Last edited by deck26 (March 4, 2015 11:37:41)

TastyFish1234
New Scratcher
6 posts

Shooting in direction

deck26 wrote:

TastyFish1234 wrote:

Crimson19 wrote:

It has to point in the direction of the gun/character. Also, you have to make sure that if the gun and the character are one sprite, you set the costume center to the gun.
It does not have a weapon, it shoots from it's mouth
That doesn't exactly make much difference to the overall idea of the advice you've received.

However looking at your original post you probably don't want the ‘go to Tera’ in the ‘repeat until’ - that may just be an error in your use of scratchblocks though.
yes it was a mistake
712343
Scratcher
3 posts

Shooting in direction

How do i make my sprite shoot i am making asteriods. Please help me!!
dimitrip
Scratcher
500+ posts

Shooting in direction

Shooting is basically
- showing a bullet sprite (or creating a clone of a base, hidden one); then
- entering a loop that moves the bullet in some direction, until the bullet hits the target, the edge of the screen, or something else
- Then you let the bullet die by deleting the clone, or by hiding it.
Greetz.
Dimitri.
deck26
Scratcher
1000+ posts

Shooting in direction

712343 wrote:

How do i make my sprite shoot i am making asteriods. Please help me!!
Please start your own topic rather than necroposting on someone else's.
cwkneeti5154
New Scratcher
7 posts

Shooting in direction

i am trying to make a ball shoot in one direction without anything making it. i tried
whenbackdropswitchesto playvgotox:pickrandom240to-240y:pickrandom180to-1800
it doesn't work. help!
deck26
Scratcher
1000+ posts

Shooting in direction

cwkneeti5154 wrote:

i am trying to make a ball shoot in one direction without anything making it. i tried
whenbackdropswitchesto playvgotox:pickrandom240to-240y:pickrandom180to-1800
it doesn't work. help!
Please start your own topic rather than necroposting. You also need to give more details or share the project. What you have there will make the sprite go immediately to a location, not move in a way that you see it moving between the start and end points.
neetivaidya
Scratcher
16 posts

Shooting in direction

also here is the link to my project

here is my profile link

thank you
neetivaidya
Scratcher
16 posts

Shooting in direction

deck26 wrote:

Crimson19 wrote:

It has to point in the direction of the gun/character. Also, you have to make sure that if the gun and the character are one sprite, you set the costume center to the gun.
It's not necessary to set the costume centre to the gun and may not be best advice. If the gun is being held out to the side of the character this would give a flipping effect when the character turned.

The main thing is that the bullets move along the line of the gun which is easiest if the gun is pointing in the direction the sprite is pointing. Then the bullet can go to the centre of the character, point in the right direction and move x steps while still hidden. The x steps bring it to the exit point of the gun. Normal firing movement takes over from there.
don't understand.

Last edited by neetivaidya (June 26, 2016 16:24:41)

neetivaidya
Scratcher
16 posts

Shooting in direction

the links are not working

thoriq12654 wrote:

You can try this
whenspacekeypressedgototerarepeatuntiltouchingnano?ortouchingsprite1?ortouchingsprite2?move10stepsiftouchingnano?ortouchingsprite1?ortouching sprite2?thenhidegototera
how do you do this if it does not go to the sprite? also i have the same problem as @cwkneeti5154
deck26
Scratcher
1000+ posts

Shooting in direction

neetivaidya wrote:

deck26 wrote:

Crimson19 wrote:

It has to point in the direction of the gun/character. Also, you have to make sure that if the gun and the character are one sprite, you set the costume center to the gun.
It's not necessary to set the costume centre to the gun and may not be best advice. If the gun is being held out to the side of the character this would give a flipping effect when the character turned.

The main thing is that the bullets move along the line of the gun which is easiest if the gun is pointing in the direction the sprite is pointing. Then the bullet can go to the centre of the character, point in the right direction and move x steps while still hidden. The x steps bring it to the exit point of the gun. Normal firing movement takes over from there.
don't understand.
Please start your own topic rather than necroposting and explain which bit you don't understand.
vaylor109
Scratcher
1 post

Shooting in direction

i tried to shoot laser from my space ship but it doesnt shoot from the the space ship. check on my game (space shooter part1)
asivi
Scratcher
1000+ posts

Shooting in direction

bump

vaylor109 wrote:

i tried to shoot laser from my space ship but it doesnt shoot from the the space ship. check on my game (space shooter part1)
https://cdn2.scratch.mit.edu/get_image/project/144269107_100x80.png
asivi
Scratcher
1000+ posts

Shooting in direction

Quite old resolved topic.
Regards.

Powered by DjangoBB