Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » how do you make a cool down when firing lasers with this script?
- jayduhhhh
- Scratcher
3 posts
how do you make a cool down when firing lasers with this script?
when green flag clicked
hide
forever
if <key [space] pressed?> then
create clone of [myself]
end
when I start as a clone
go to [spaceship]
point in direction (90)
show
repeat until <touching [edge] >
move (10) steps
delete this clone
end
- Cool_Dude2022
- Scratcher
100+ posts
how do you make a cool down when firing lasers with this script?
when green flag clicked
hide
forever
if <key [space] pressed?> then
create clone of [myself]
end
when I start as a clone
go to [spaceship]
point in direction (90)
show
repeat until <touching [edge] >
move (10) steps
delete this clone
end
You can use a variable to do this easily:
when green flag clicked
hide
forever
if <<key [space] pressed?> and <(Cooldown) = [F]>> then
create clone of [myself]
end
when I start as a clone
set [Cooldown v] to [T]
go to [spaceship]
point in direction (90)
show
repeat until <touching [edge] >
move (10) steps
delete this clone
set [Cooldown v] to [F]
end
Did I help you fix your problem? If so, please nominate my project to be featured!
If my code is used, credit is NOT required
- MrKingofScratch
- Scratcher
100+ posts
how do you make a cool down when firing lasers with this script?
the simplest solution is
foreverHowever, you can mess around with
if <key [space v] pressed?> then
create clone of [myself v]
wait (cooldown amount here) secs
end
end
(timer)(set a “target” time that when reached should end the cool down, then wait until the timer is at that number)
Last edited by MrKingofScratch (March 28, 2024 17:32:28)
- jayduhhhh
- Scratcher
3 posts
how do you make a cool down when firing lasers with this script?
PS. in laser sprite
- jayduhhhh
- Scratcher
3 posts
how do you make a cool down when firing lasers with this script?
THANK YOU!
- Shrek_em
- Scratcher
34 posts
how do you make a cool down when firing lasers with this script?
@MrKingofScratch 's solution is far easier that the other one the simplest solution isforeverHowever, you can mess around with
if <key [space v] pressed?> then
create clone of [myself v]
wait (cooldown amount here) secs
end
end(timer)(set a “target” time that when reached should end the cool down, then wait until the timer is at that number)
Shrek_em
Really bad coder
Really good ideas
Want to make a signature?
Click this purple thing to figure out how
- Discussion Forums
- » Help with Scripts
- » how do you make a cool down when firing lasers with this script?