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

Disabling auto-fire

Archive: 4 posts


http://i.imgur.com/4cJwN.jpg

If you want to make a 2D shooting game like Duck Hunt, you might want to avoid the player pressing down the Fire button continously and just moving the target which tag will therefore be constantly activated. You need a logic that prevents auto-firing, by forcing the player to release the Fire button before the tag activates again.

As the picture above clearly depicts, there are 4 logic elements to use :
- NOT gate
- Timer (Parameters : 0.1s, start countdown, reverse output)
- AND gate
- Tag key

Here is how it works :
- At the very moment when the player presses X (or any Fire command), the inputs of the AND gate are :

X (active)
Reserve-output timer @ 0.0s/0.1s (active)

With both inputs active, the output is active and the tag key is emitting.

The situation stays the same until the timer reaches 0.1s/0.1s : the timer's output switches to inactive, which disables the AND gate's second input and sets the AND gate's output to inactive => the tag is deactivated.

The NOT gate reverses the status of the X button. When X is not pressed, the timer resets. When X is pressed, the timer reaches 0.1s and isn't reset. Which means that when the player presses X, and then unpresses it again, the timer resets and the situation is the same as before X was pressed.

Voil? !
2011-02-23 20:02:00

Author:
Unknown User


I simply use a Single Counter, which activates the Tag & Its own reset...

Then the Tag will only be on when X is tapped (Holding it down does not send a repeated signal)
2011-02-23 23:14:00

Author:
Nurolight
Posts: 918


That's... obvious. ****.

Edit : now that I think about it, I believe I tried this first and it didn't work (the simple counter method). Gotta try it again to make sure, even if in theory it's meant to work.
2011-02-23 23:27:00

Author:
Unknown User


That's... obvious. ****.

Edit : now that I think about it, I believe I tried this first and it didn't work (the simple counter method). Gotta try it again to make sure, even if in theory it's meant to work.

Thats the thing I noticed, Timer and Counter are really the same, except Counter react to an input once, where as Timers continue with the input
2011-02-24 00:41:00

Author:
Nurolight
Posts: 918


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.