Author Topic: Waiting for key_press?  (Read 3849 times)


  • Newcomer
  • Posts: 33
  • Karma: +0/-0
    • View Profile
    • Email
Waiting for key_press?
« on: March 03, 2017, 01:50:12 AM »
Is there a particular reason the roguelike tutorial on Roguebasin wants you to have directional keys that function with no delay? I'm using the default input functionality for strings in Ruby, and this is the first time I've heard of wait for keypress.

What I do is something more like this:

Code: [Select]
print "Which direction: "
input = gets.chomp
if input == "Go Up"
elsif input == "Go Left"
elsif input == "Go Right"
elsif input == "Go Down"
elsif input == "Go Pass Phrase"
  # For geo-location based encryption.
elsif input == "Check Menu"
  # Checking the menu.
elsif input == "Open Laptop"
  # Opening the laptop. Seperate menu for laptop.
  # If nothing or unavailable command is typed.

Of course I'm not going for pure rogue like, but text adventure with rogue like elements.

I'm interested in learning movement based on key press. just going to have to relearn everything. As ManWithCode only taught me how to get input based on string data.

I did manage a title screen:

The reason I'm using strings at the moment, is because I'm eventually wanting to do pass phrase based navigation. Such as, in case of rationing out steps in a dungeon, your movement might be: 1-3-6-12-14-25.

Which would translate to: MC automatically moves the next fastest route to minimize step usage. Go beyond fifteen, it activates alarm. The alarm switches to battle mode.

As supposed to a lesser pass phrase, that trips the alarm. (My game is going to focus on stealth, not combat.)
« Last Edit: March 03, 2017, 02:01:57 AM by SarahW »


  • Guest
Re: Waiting for key_press?
« Reply #1 on: October 25, 2017, 08:09:58 AM »
This is so wonderful that I found it.