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

#1 2011-03-01 11:21:04

matthew9090
New Scratcher
Registered: 2011-03-01
Posts: 3

how do you make a bullet shoot?

<play sound[ i need help because when i click a bullet shoots but doesn't stop shooting even when the mouse is not pressed.

current code:

when green flag clicked
goto turret
hide
forever if mouse down?
point towards mouse pointer
show
forever
move 10 steps


when green flag clicked
forever if
touching border(sprite)
hide

Offline

 

#2 2011-03-01 12:55:29

Pecola1
Scratcher
Registered: 2010-09-06
Posts: 1000+

Re: how do you make a bullet shoot?

matthew9090 wrote:

i need help because when i click a bullet shoots but doesn't stop shooting even when the mouse is not pressed.

current code:

when green flag clicked
goto turret
hide
forever if mouse down?
point towards mouse pointer
show
forever
move 10 steps


when green flag clicked
forever if
touching border(sprite)
hide

Your problem is putting a forever loop inside another forever loop which will stop the one it is inside. Try:
when green flag clicked
goto turret
hide
forever if mouse down?
point towards mouse pointer
show
repeat until touching edge?
move 10 steps


when green flag clicked
forever if
touching border(sprite)
hide
use the repeat until so it will not go forever.

Last edited by Pecola1 (2011-03-01 12:56:17)


If you are reading this, please read to the end, because if you don't you won't know what's at the end. Don't just skip to the end though otherwise you won't be able to read the middle, which is most important. Now you must be wondering why you just read all that, the reason is you may have not noticed something, read it again and see if you notice it this time  smile

Offline

 

Board footer