Home LittleBigPlanet 2 - 3 - Vita - Karting LittleBigPlanet 2 [LBP2] Help!
#1
Tower Defense: Change how much damage is dealt depending on what projectile is used?
Archive: 6 posts
First off, I'm a fairly skilled logic designer in LBP 2, but I've hit a snag. I'm making a tower defense level, but I'm having trouble changing the amount of damage each type of shot does. Right now, I'm using timers attached to "pulsers" (single shot counters) that activate each time the enemy is hit, and when the timer reaches full, the enemy dies. The problem is that every shot does 1 point of damage, but I want different shots to do different amounts of damage. Also, a problem I foresee this that when multiple shots hit at the same time, the counter(s) can only activate the timer once, so only one damage would be done, rather than the "x" amount of damage that should have been dealt. Would attaching a timer to the reset of the counter work to change amount of damage dealt. Shot -> activates counter -> activates timer damage + reset timer. Reset timer resets counter after "x" time, stopping damage. I don't see this working very well, as one point of damage is less than half of the 0.1 second timer, but even the shortest timer would deal all 0.1 seconds of damage since the reset would only occur after 0.1 seconds. I could make the damage scale larger, but doing so will make it seem like damage appears as damage over time (which would look kinda strange, especially on the larger damages, and may also stop all other damage from being taken due to the "multiple damage input issue" I outlined above) [Edit: Am now working on a counter based system with a selector which detects damage input type, then activates a series of timers delayed by 0.1-X.X seconds each (so 10 damage per second if hit that often). This system works, but is limited just like the original system, just less so. I've seen a few levels that have different damage inputs on enemies, but how is it done? I'll credit whoever explains it to me when I get my level finished. | 2011-01-28 09:19:00 Author: SSTAGG1 Posts: 1136 |
Use and AND gate to combine the pulser with a battery. this will give a min() function on the two signals, essentially outputting the value of the battery for a single clock cycle (0.033s). If your timer is set to speed input then the amount of damage done will vary based upon the %value of the battery. You can detect concurrent impacts from different weapons by adding these signal strengths together before inputting them into the timer - therefore strength of hit A and strength of hit B will add up in the same clock cycle. The other issue is simultaneous hits / hits in consecutive clock cycles from the same weapon. Possibly the most robust way around this is to alternate between tag colours on projectiles, especially for the more common weapons - so a basic cannon might be tagged as "cannonFire" and have 8 variants of that tag. It's complex, but it would massively reduce the failure cases. Personally, I think that impact switches need a "number of simultaneous impacts to activate" type thing, same as tag sensors have. | 2011-01-28 10:32:00 Author: rtm223 Posts: 6497 |
Wow, never used batteries to adjust the signal before, but it works perfectly. Thank you. One question though: How do I go about combining the output of the batteries into one signal that has the sum of their signal strengths? I've never used them before, so I'm not too familiar with how they function. I've made a separate battery input for each damage value (100%-10%, etc...), but when I combine them using a gate (have tried various different combinations of gates as well), the signal produced is always the strength of the strongest one (50% + 25% input = 50% output). Could you please explain how the combination is done? __________ The multiple tags being used for each shot would solve the issue with multiple shots of the same kind (at least as long as the tags activating at the same time were different, which is highly probable). I still don't know how much an effect multiple emitters emitting holo projectiles costs on the thermo, so having to produce multiple types of the basic shots, and a few types of the advanced shots (I have 20 different shots. 4 shot types, lightning, laser, splash, and penetration, along with 5 different strengths of each shot) may not be in my best interests, but I'll give it a whirl anyway. Many thanks for explaining this method to me, makes adjusting damage ridiculously easy. Just need help with the battery signal combination. | 2011-01-28 23:59:00 Author: SSTAGG1 Posts: 1136 |
I had one of these working in the beta, but it was a bit sloppy compared to what Rtm described. Can't believe I didn't think to just vary the strengths of the pulses (I had them both set to 50% but varied the lengths of the pulses). I also had a counter/buffer to store consecutive hits. Can't remember exactly how I did that, but if I can suss it out, I'll tell you. As for adding analog signals, the best thing you can do is check out Rtm's logic blog, but I can tell you how to do yours. Run your first signal through a NOT gate, plug its output into either end of directional combiner, and plug your next signal into the other end of a combiner, add another combiner for each additional signal and wire the final output into your timer. Make sure that the total of all your signals doesn't exceed 100% (so if you've got 3 inputs, one for 1hp, one for 2hp, and 1 for 3hp, set one for 20%, the next for 40% and the last for 60%). | 2011-01-29 04:49:00 Author: Sehven Posts: 2188 |
hey sstagg, I am working on a tower defense game too. You and I seem to be working on the same problem right now. If you would like to get together sometime and compare notes, I would love to. | 2011-01-29 04:58:00 Author: tdarb Posts: 689 |
I had one of these working in the beta, but it was a bit sloppy compared to what Rtm described. Can't believe I didn't think to just vary the strengths of the pulses (I had them both set to 50% but varied the lengths of the pulses). I also had a counter/buffer to store consecutive hits. Can't remember exactly how I did that, but if I can suss it out, I'll tell you. As for adding analog signals, the best thing you can do is check out Rtm's logic blog, but I can tell you how to do yours. Run your first signal through a NOT gate, plug its output into either end of directional combiner, and plug your next signal into the other end of a combiner, add another combiner for each additional signal and wire the final output into your timer. Make sure that the total of all your signals doesn't exceed 100% (so if you've got 3 inputs, one for 1hp, one for 2hp, and 1 for 3hp, set one for 20%, the next for 40% and the last for 60%). Awesome, thanks. hey sstagg, I am working on a tower defense game too. You and I seem to be working on the same problem right now. If you would like to get together sometime and compare notes, I would love to. Be prepared for a giant wall of microchips, lol. There are no notes yet, so you'll have to just follow what I say. I'll message you when it's presentable (running into some issues currently, I know what the issue is though, so should be fixed soon). | 2011-01-29 09:59:00 Author: SSTAGG1 Posts: 1136 |
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.
Die Nutzung dieser Webseite erfolgt ohne Speicherung personenbezogener Daten. Es werden keinerlei Cookies, Logs, 3rd-Party-Plugins etc. verwendet.