This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2012-07-10 12:30:28

DonutCannon
New Scratcher
Registered: 2012-07-02
Posts: 29

Infinite Distance Gunshot

Hey, so I've been working on a gun that shoots bullets. I have most things done, but now I need a way to make the bullet continue on forever. So far I have a script that shoots a bullet to the mouse using a glide block, but I need it to go until it reaches the border of the screen, even if the mouse isn't there. I hope that makes sense  big_smile

Thanks in advance.

Offline

 

#2 2012-07-10 12:39:21

scimonster
Community Moderator
Registered: 2010-06-13
Posts: 1000+

Re: Infinite Distance Gunshot

when i receive
shoot
point towards
mouse-pointer
repeat until
touching
edge
?
move
5
steps

Offline

 

#3 2012-07-10 12:41:16

AtomicBawm3
Scratcher
Registered: 2009-06-27
Posts: 1000+

Re: Infinite Distance Gunshot

DonutCannon wrote:

Hey, so I've been working on a gun that shoots bullets. I have most things done, but now I need a way to make the bullet continue on forever. So far I have a script that shoots a bullet to the mouse using a glide block, but I need it to go until it reaches the border of the screen, even if the mouse isn't there. I hope that makes sense  big_smile

Thanks in advance.

Instead of using a glide block, use direction and move blocks...something like this should work:

when I receive
shoot
This is how I would do it with a bullet, but maybe you did it differently
go to
player
point towards
mouse-pointer
show
repeat until
touching
edge
?
move
number
steps
hide

EDIT: Wow, that's scary similar in timing and in script suggestion  smile

Last edited by AtomicBawm3 (2012-07-10 12:42:23)


http://i50.tinypic.com/j0yw0p.jpg

Offline

 

#4 2012-07-10 13:17:40

DonutCannon
New Scratcher
Registered: 2012-07-02
Posts: 29

Re: Infinite Distance Gunshot

Ok, trying to make a form of accuracy.

Trying to use

[scratchblocks]
point towards [mouse-pointer]
point towards <<pick random (-20) to (20)> + <direction>
{scratchblocks]

Does not appear to work...

Offline

 

#5 2012-07-10 13:30:46

zammer990
Scratcher
Registered: 2012-01-22
Posts: 500+

Re: Infinite Distance Gunshot

DonutCannon wrote:

Ok, trying to make a form of accuracy.

Trying to use

point towards
mouse-pointer
point in direction
pick random
-20
to
20
+
direction

Does not appear to work...

fixed
your
scripts


http://i45.tinypic.com/2ynq7nn.jpg Play now!

Offline

 

#6 2012-07-10 13:44:52

DonutCannon
New Scratcher
Registered: 2012-07-02
Posts: 29

Re: Infinite Distance Gunshot

zammer990 wrote:

DonutCannon wrote:

Ok, trying to make a form of accuracy.

Trying to use

point towards
mouse-pointer
point in direction
pick random
-20
to
20
+
direction

Does not appear to work...

fixed
your
scripts

Thanks. I saw the problem after writing, and I dunno how to edit my posts  sad

Offline

 

#7 2012-07-10 13:53:44

zammer990
Scratcher
Registered: 2012-01-22
Posts: 500+

Re: Infinite Distance Gunshot

DonutCannon wrote:

zammer990 wrote:

DonutCannon wrote:

Ok, trying to make a form of accuracy.

Trying to use

point towards
mouse-pointer
point in direction
pick random
-20
to
20
+
direction

Does not appear to work...

fixed
your
scripts

Thanks. I saw the problem after writing, and I dunno how to edit my posts  sad

You can't until you're a scratcher, then there's just a box that says "edit" next to report


http://i45.tinypic.com/2ynq7nn.jpg Play now!

Offline

 

#8 2012-07-10 14:08:26

SciTecCf
Scratcher
Registered: 2011-11-23
Posts: 1000+

Re: Infinite Distance Gunshot

For a nice effect, try this:

go to
cannon
point in direction
direction
of
cannon
set
inaccuracy
to
pick random
-0.10
to
0.10
set
speedgain
to
pick random
0.010
to
1.000
set
speed
to
1
-
speedgain
if
pick random
1
to
2
=
1
set
dir
to
1
else
set
dir
to
2
repeat until
touching
edge
?
move
speed
steps
change
speed
by
speedgain
if
dir
=
1
turn
inaccuracy
degrees
else
turn
inaccuracy
degrees

Last edited by SciTecCf (2012-07-10 14:11:13)


http://bit.ly/LCZEJRhttp://bit.ly/LSONcOhttp://bit.ly/LF3vIc
http://trinary.site40.net/images/scratchrank.php?username=SciTecCf&amp;display=small

Offline

 

#9 2012-07-10 14:10:20

zammer990
Scratcher
Registered: 2012-01-22
Posts: 500+

Re: Infinite Distance Gunshot

SciTecCf wrote:

For a nice effect, try this:

go to
cannon
point in direction
direction
of
cannon
set
inaccuracy
to
pick random
-0.10
to
0.10
set
speedgain
to
pick random
0.010
to
1.000
set
speed
to
1
-
speedgain
repeat until
touching
edge
?
move
speed
steps
change
speed
by
speedgain

That would give the potential for an accelerating bullet, I guess it depends if you want realism or random


http://i45.tinypic.com/2ynq7nn.jpg Play now!

Offline

 

#10 2012-07-10 14:37:48

DonutCannon
New Scratcher
Registered: 2012-07-02
Posts: 29

Re: Infinite Distance Gunshot

zammer990 wrote:

DonutCannon wrote:

Ok, trying to make a form of accuracy.

Trying to use

point towards
mouse-pointer
point in direction
pick random
-20
to
20
+
direction

Does not appear to work...

fixed
your
scripts

K, got it to work. Thanks

Finished product here:
http://scratch.mit.edu/projects/DonutCannon/2666366

Of course, this isn't quite a game yet...

Offline

 

Board footer