Home    LittleBigPlanet 2 - 3 - Vita - Karting    LittleBigPlanet 2    [LBP2] Help!
#1

Ammo Refill

Archive: 4 posts


I created a sackbot similar to Megaman who can fire projectiles. He can change weapons with the triangle button. These weapons have ammo counts in the form of an HP Bar. When the Ammo Bar is empty he can't fire his attack anymore. But as I get items to increase ammo, I still cant fire my attack until the ammo bar is full again. I'm sorry I'm not near my PS3 right now so I can't provide a picture of the logic. Can someone just provide a generic example of how to use ammo again without having to fill it up completely?

For the logic, I plugged the Timer(ammo bar) and the firing button into an AND GATE. The AND GATE plugged into a timer's input and reset, and the timer plugged into an emitter. The AND GATE is plugged into a timer because it's a charge attack, where I hold down the fire button while the timer fills up, and release the button for the attack. When I am out of ammo, of course I can't shoot anymore, but I can't shoot anymore until I completely refill the ammo bar. Any suggestions on what to do?
2011-02-26 23:07:00

Author:
rambo3416
Posts: 179


Why don't you use a counter instead of a timer? Set the weapon shoot bytton to the counter's "decrement" input, and attatch whatever sensor you use to make the power-up disappear to the counter's "increment" input. I hope this helps.2011-02-27 04:17:00

Author:
Leafy101
Posts: 154


I thought about it, but I use a timer for my health bar, and it works great. Thought I would do the same for the ammo bar. I guess it would still look the same. I'll give it a try.2011-02-27 04:38:00

Author:
rambo3416
Posts: 179


The problem you're running into is that timers output both an analog and a digital signal. The analog signal is the percentage of the timer that's full and the digital is simply on/off. Timers have the interesting quirk that their digital components don't turn on until they're completely full and they don't turn off again until they're completely empty (I believe counters have the same issue). What you'll want to do is convert the analog signal from the timer to a digital signal so that any amount of signal in the timer equals a 100% ON signal. There's probably an easier way, but the method I use is to hook the timer's output into a sequencer, set the sequencer to positional, and place a battery that covers the whole sequencer (make sure it doesn't run off the ends, though). This way any percentage of signal from the timer will turn on the battery.2011-02-27 06:13:00

Author:
Sehven
Posts: 2188


LBPCentral Archive Statistics
Posts: 1077139    Threads: 69970    Members: 9661    Archive-Date: 2019-01-19

Datenschutz
Aus dem Archiv wurden alle persönlichen Daten wie Name, Anschrift, Email etc. - aber auch sämtliche Inhalte wie z.B. persönliche Nachrichten - entfernt.
Die Nutzung dieser Webseite erfolgt ohne Speicherung personenbezogener Daten. Es werden keinerlei Cookies, Logs, 3rd-Party-Plugins etc. verwendet.