# Reload time

**URL:** <https://forum.kirupa.com/t/reload-time/115004>\
**Category:** Uncategorized\
**Created:** [July 4, 2004, 3:59pm UTC](https://forum.kirupa.com/t/reload-time/115004 "2004-07-04T15:59:51Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Moopers](https://avatars.discourse-cdn.com/v4/letter/m/b782af/32.png) [@Moopers](https://forum.kirupa.com/u/Moopers)\
**Post date:** [July 4, 2004, 3:59pm UTC](https://forum.kirupa.com/t/reload-time/115004/1 "2004-07-04T15:59:51Z")

</div>

ok, i made a game with a guy and a gun. you can fire your gun continuously without stopping. i’m just wondering(cause firing continuously is cheap), if anyone knows how to make it so that your gun has a reload time (i.e. 1 sec)?

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 4, 2004, 4:57pm UTC](https://forum.kirupa.com/t/reload-time/115004/2 "2004-07-04T16:57:30Z")

</div>

Well theres probably a bunch of ways to do this. This is probably not the best way to do it but make a seperate sub animation under the character guy and label it reload. Then…

[AS]  
//under main guy for reload script  
if (Key.isDown(Key.RELOAD) && !reloading) {  
reloading = true;  
this.gotoAndStop(“reload”);  
}

//then go into the reload label animation. say if you have 15 fps make a keyframe on frame 15 and then add something like:

\_parent.reloading = false;  
\_parent.bullets = whateverthemaxamountis;  
[/AS]

You could do something like that, it’s probably not the best way to go about doing it though.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 4, 2004, 7:50pm UTC](https://forum.kirupa.com/t/reload-time/115004/3 "2004-07-04T19:50:13Z")

</div>

umm thats not exactly what i want, i want it so that(say spacebar is to fire) if you hold space, your bullet(in this case mine is a laser) will fire once a second or so.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 5, 2004, 5:40am UTC](https://forum.kirupa.com/t/reload-time/115004/4 "2004-07-05T05:40:48Z")

</div>

in that try something like this…  
[AS]  
onClipEvent (load) {  
fire = false;  
}  
onClipEvent (enterFrame) {  
if (Key.isDown(Key.SPACE) && !fire) {  
fire = true;  
this.gotoAndStop(“firing”);  
}  
}

//Then like 15 frames out on a sub firing animation add something like…  
\_parent.fire = false;  
[/AS]

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 5, 2004, 8:18am UTC](https://forum.kirupa.com/t/reload-time/115004/5 "2004-07-05T08:18:09Z")

</div>

Or you can use setInterval, and only allow a new laser to be fired once the interval has passed …

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 6, 2004, 1:16am UTC](https://forum.kirupa.com/t/reload-time/115004/6 "2004-07-06T01:16:17Z")

</div>

yes tommy, that’s what i wanted, just didn’t know what the command was
