Hook
I'm finna teach y'all how to put a binary trigger on the Baby Draco in Python. Alright twin, so the first thing we're going to do, we're going to import time because it takes time to pull the trigger. Now we get our mag and we load it with how much ammo we got. But this mag is also called an array, and we use an array to store our bullets or our data. It's about that time to unload the mag. So how a binary trigger works, you pull and release. So now we're going to create a while loop. What this while loop is saying, as long as we got more than one bullet in the mag, then we can keep on letting two off. You might be asking yourself, how do we remove bullets from the mag or how do we remove elements from an array? Well, we use pop to do it. So we're going to add a pop in there when we pull and a pop in there when we release. And I already know you're finna ask, why do we stop the while loop at one? It's a good question, twin. We stop the while loop at one because if we have an odd amount of ammo, then we can't let two off. And you already know we can't leave no bullets in there. So how we going to get rid of it? We create an if statement. So if anything else is left in the mag after that while loop, then we do one last pop, one last fire, get it out of there, and we done. Now when we run the code, it look like this.
More breakout videos from this creator.