Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » how do i make a flashlight
- robotfan218-testing
-
Scratcher
12 posts
how do i make a flashlight
so i wanted to try something and i wanted to make like a flashlight (one that you hold, not one that goes to your mouse)
however, i have no clue how. can someone help me (and by help i mean tell me how) to do that
however, i have no clue how. can someone help me (and by help i mean tell me how) to do that
- toasty_mc_toastface
-
Scratcher
99 posts
how do i make a flashlight
Simplest way to make a flashlight is to get a sprite with a costume which is completely black but with a hole in the middle. If you want to partly see sections not under the flash light then turn up the ghost effect.
- firesprison
-
Scratcher
19 posts
how do i make a flashlight
I have a game, its currently in a work in progress. Its basically what you want. If you want to see, heres the link because the code is too long to share. If you want a flashlight that dims as it goes further, set pen color to white and set a pen transparency.
https://scratch.mit.edu/projects/761675770
https://scratch.mit.edu/projects/761675770
- SuperGamerGG2
-
Scratcher
88 posts
how do i make a flashlight
Try this:
Make a project, add a sprite called light, cover the entire sprite costume with a giant black rectangle, cut a triangular hole facing this –> way, then add this code:
And in the sprite that's holding the flashlight, make two costumes: one facing right (–>) and one facing left (<–).
Then add this code in the same sprite:
Then you're done!
Make a project, add a sprite called light, cover the entire sprite costume with a giant black rectangle, cut a triangular hole facing this –> way, then add this code:
when green flag clicked
forever
point towards [mouse pointer v]
end
when green flag clicked
go to x: [flashlight x] y: [flashlight y]
And in the sprite that's holding the flashlight, make two costumes: one facing right (–>) and one facing left (<–).
Then add this code in the same sprite:
when green flag clicked
forever
if <(mouse x) < [0]> then
switch costume to [facing left v]
else
switch costume to [facing right v]
Then you're done!
- Milkyplay
-
Scratcher
1 post
how do i make a flashlight
Did that help? Or can I do it for you?My flashlight didn't work!



- CastyEZ
-
Scratcher
4 posts
how do i make a flashlight
it really depends on what your game is aboutDid that help? Or can I do it for you?My flashlight didn't work!
is it a top-down game? is your flashlight a beam from heaven? or a cone originating from the player?
do you need things to overlay your flashlight? be specific so we can help you
- Discussion Forums
- » Help with Scripts
-
» how do i make a flashlight