Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » Weapon swaping while having in sprite animations
- FlyingOctopusShape
-
Scratcher
8 posts
Weapon swaping while having in sprite animations
I'm trying to make a top down shooter that is basically classic DOOM but not violent, and obviously top down. I have weapon switching working fine, but i have animations that play when the player shoots that stop the player from switching weapons, and I'm not sure how to counteract that.
for more context i have 6 weapons. pistol, shotgun, super shotgun, chaingun, chainsaw, and rocket launcher, each with separate bullet looks, fire rates, spreads, etc. the animations play, and then the weapons have a cooldown, but since all the weapons are in the same sprite, the animation plays, and then the player cannot swap weapons until said animation is over, which can be up to 3 seconds which doesn't work with the fast-paced gameplay I want.
Help much appreciated.
for more context i have 6 weapons. pistol, shotgun, super shotgun, chaingun, chainsaw, and rocket launcher, each with separate bullet looks, fire rates, spreads, etc. the animations play, and then the weapons have a cooldown, but since all the weapons are in the same sprite, the animation plays, and then the player cannot swap weapons until said animation is over, which can be up to 3 seconds which doesn't work with the fast-paced gameplay I want.
Help much appreciated.
- kingjaw2
-
Scratcher
91 posts
Weapon swaping while having in sprite animations
Why is the weapons animation 3 seconds? Or do you mean the cooldown?
- FlyingOctopusShape
-
Scratcher
8 posts
Weapon swaping while having in sprite animations
Why is the weapons animation 3 seconds? Or do you mean the cooldown?for the rocket launcher, the cooldown between shots is 2.5 seconds.
- kingjaw2
-
Scratcher
91 posts
Weapon swaping while having in sprite animations
If the cooldown wait block is in your main weapon loop, you should probably move it out. You could add a new “shoot” message that, when recieved by the weapon sprite, triggers a variable that lets you shoot to be set to false as well as a wait block. You could change the wait block depending on the weapon type for different cooldowns by just making a bunch of if-else statements. Of course, after the wait block you could make it so the player can shoot again. Then, the player should be able to swap weapons when they want.
- SpinOutGamesOfficial
-
Scratcher
1 post
Weapon swaping while having in sprite animations
If the cooldown wait block is in your main weapon loop, you should probably move it out. You could add a new “shoot” message that, when recieved by the weapon sprite, triggers a variable that lets you shoot to be set to false as well as a wait block. You could change the wait block depending on the weapon type for different cooldowns by just making a bunch of if-else statements. Of course, after the wait block you could make it so the player can shoot again. Then, the player should be able to swap weapons when they want.link to da project: https://scratch.mit.edu/projects/948601284/
- FlyingOctopusShape
-
Scratcher
8 posts
Weapon swaping while having in sprite animations
sorry alt account lolIf the cooldown wait block is in your main weapon loop, you should probably move it out. You could add a new “shoot” message that, when recieved by the weapon sprite, triggers a variable that lets you shoot to be set to false as well as a wait block. You could change the wait block depending on the weapon type for different cooldowns by just making a bunch of if-else statements. Of course, after the wait block you could make it so the player can shoot again. Then, the player should be able to swap weapons when they want.link to da project: https://scratch.mit.edu/projects/948601284/
- FlyingOctopusShape
-
Scratcher
8 posts
Weapon swaping while having in sprite animations
that is the project thosorry alt account lolIf the cooldown wait block is in your main weapon loop, you should probably move it out. You could add a new “shoot” message that, when recieved by the weapon sprite, triggers a variable that lets you shoot to be set to false as well as a wait block. You could change the wait block depending on the weapon type for different cooldowns by just making a bunch of if-else statements. Of course, after the wait block you could make it so the player can shoot again. Then, the player should be able to swap weapons when they want.link to da project: https://scratch.mit.edu/projects/948601284/
- FlyingOctopusShape
-
Scratcher
8 posts
Weapon swaping while having in sprite animations
the code im using is: (sorry if it it doesn't look right, i haven't used the scratch forums before)
if <(weapon) = [Super shotgun]> then
switch costume to [ (join (join (weapon) [(dir)] [2 ]
wait (0.02) secs
switch costume to [ (join (join (weapon) [(dir)] [1 ]
wait (1.5) secs
switch costume to [ (join (join (weapon) [(dir)] [1 ]
end
Last edited by FlyingOctopusShape (Jan. 14, 2024 20:07:40)
- Discussion Forums
- » Help with Scripts
-
» Weapon swaping while having in sprite animations