Intercepting Shift+direction keystrokes

NOTE: I HATE A LOT OF YOUR ZZT GAMES, SO WATCH OUT!

Moderators: Commodore, Zenith Nadir

Post Reply
User avatar
Quantum P.
Level 17 Accordion Thief
Posts: 1433
Joined: Fri Sep 12, 2003 1:41 am
Location: Edmonds, WA
Contact:

Intercepting Shift+direction keystrokes

Post by Quantum P. »

Something I've been playing with for the last few days. Just an experiment, not a full game.

Setup: You have a player clone surrounded by breakables and objects, like so:

Image

Whenever the player shoots, the player clone shoots as well. This destroys one of the breakable walls; one of the objects detects this, replaces the breakable wall, and sends out the message that the player has fired a shot north, or whatever.

Idea: Add two objects to the board, a giver and a taker. The giver #gives 1 ammo every cycle, and the taker #takes one ammo every cycle. There is no net change -- the cycle begins and ends with the player having 0 ammo.

However, there is a brief period when ammo is 1. So we get clever with the order of the stat list, and we create the giver first, then the player clone, then the taker. The result is that the player has no ammo, yet the player clone does.

As a result, the user can press Shift+direction, and the clone-breakable-detector assembly will detect it, but the player will not emit a bullet. Could be useful for designing an engine -- the download has an example where pressing Shift+direction does not shoot, but instead chooses a weapon.
User avatar
Commodore
fgsdfs
Posts: 2471
Joined: Wed Mar 12, 2003 5:44 pm
Location: :noitacoL
Contact:

Post by Commodore »

impressive enough, very fast and since it's a technique not code there's no overhead.

what interested me more was the way you detected the explosions with alternating normal/fake walls and detecting blocked/not blocked on the same line of code.
*POW* *CLANK* *PING*
User avatar
Quantum P.
Level 17 Accordion Thief
Posts: 1433
Joined: Fri Sep 12, 2003 1:41 am
Location: Edmonds, WA
Contact:

Post by Quantum P. »

The am-I-next-to-an-explosion technique required some fiddling, but it came out nice. Sometimes it triggers accidentally if you have a bunch of enemies bumping into each other, but two #if blocked statements does a surprisingly accurate job.

Most of the accidental triggers are hard to notice anyway, since stuff blows up where enemies tend to congregate. But every now and then you can see someone die who wasn't exactly adjacent to the explosion.
User avatar
Commodore
fgsdfs
Posts: 2471
Joined: Wed Mar 12, 2003 5:44 pm
Location: :noitacoL
Contact:

Post by Commodore »

I noticed it because I did a similar thing using a slime for a explosion in EFCW, but my detection was simply to check if the enemy was completely surrounded, which of course also threw some false positives and made the explosions generally not very effective unless in a closed space.
*POW* *CLANK* *PING*
User avatar
Commodore
fgsdfs
Posts: 2471
Joined: Wed Mar 12, 2003 5:44 pm
Location: :noitacoL
Contact:

Post by Commodore »

I also edited the wiki to point to this thread :)
*POW* *CLANK* *PING*
Post Reply