Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » I need help making a laser pointer(pen)
- egashu
-
Scratcher
100+ posts
I need help making a laser pointer(pen)
I need a laser pointer that stops when it hits an objectI've tried clones and it works but not how I want it too. If any body could help that would be great thanks!!!
- CurtisThePotato
-
Scratcher
34 posts
I need help making a laser pointer(pen)
Make another sprite that will be dedicated to drawing the laser. Make sure you run
set [ ghost] effect to (100)to make it invisible, but still able to interact with other sprites. Then use this script to make your laser. It will activate when you broadcast a message and stop when it touches any other sprite.
show
when I receive [ your message]If you do not know where the pen extension is, go into the bottom left corner of the scratch editor and click on the blue button, then select pen.
set pen color to [red] //prepares the pen
set pen size to (5)
repeat until <touching [ anything] ?> //repeats while the pen isn't touching anything
clear
go to [ mouse-pointer]
pen down
pen up //goes to the mouse and makes a dot then deletes any old dots
end
- PinkTabbyHunterLargo
-
Scratcher
100+ posts
I need help making a laser pointer(pen)
(Scratchblocks have been fixed)
Make another sprite that will be dedicated to drawing the laser. Make sure you runset [ghost v] effect to (100)to make it invisible, but still able to interact with other sprites. Then use this script to make your laser. It will activate when you broadcast a message and stop when it touches any other sprite. (it won't be able to interact using the “when this sprite clicked” block)
showwhen I receive [your message v]If you do not know where the pen extension is, go into the bottom left corner of the scratch editor and click on the blue button, then select pen.
go to x: (0) y: (0) // or whatever location you want the laser to start from
set pen color to [#ff0000] //prepares the pen
set pen size to (5)
repeat until <<touching [wall v] ?> or <touching [other sprite v]?>> // put "other sprite" to any other sprites, if there are any, else remove
point towards [mouse-pointer v] // if you want the laser to be coming from something
clear // this would be "erase all" in 3.0 [added]
set [ghost v] effect to (100) // if you want the laser to be coming from something
go to [mouse-pointer v]
pen down
pen up // goes to the mouse and makes a dot
go to x: (0) y: (0) // or whatever location you want the laser to start from
set [ghost v] effect to (0) // if you want the laser to be coming from something
end
Last edited by PinkTabbyHunterLargo (July 3, 2019 14:03:31)
- KingOfDareWolves
-
New Scratcher
1 post
I need help making a laser pointer(pen)
I want to make a laser for my fruit ninja game. It is the last part left.
It should stay with mouse-pointer and should show when the mouse pointer touches the fruit or bomb and then hide.
Please help.
It should stay with mouse-pointer and should show when the mouse pointer touches the fruit or bomb and then hide.
Please help.
- scratchcodinggames2
-
Scratcher
1 post
I need help making a laser pointer(pen)
For me it should work perfectly because I am doing what electromanrocks718 did but when I draw the lasers go in random places. Can you help?
- CvF11
-
Scratcher
3 posts
I need help making a laser pointer(pen)
when green flag clicked
forever
clear
pen down
go to [Mouse pointer v]
pen up
set pen color to [any color]
end
- Harakou
-
Scratcher
1000+ posts
I need help making a laser pointer(pen)
Hi! Thank you for offering your help, but this thread is pretty old - I don't think it's relevant anymore. When you respond to a topic, please make sure it's recent and the original poster still needs an answer. Thanks!when green flag clicked
forever
clear
pen down
go to [Mouse pointer v]
pen up
set pen color to [any color]
end
- Discussion Forums
- » Help with Scripts
-
» I need help making a laser pointer(pen)






