Gigoteur / UnicornConsole

Unicorn Console: create quick fantasy game in Rust/Python/Lua/Rhai/Wasm !
MIT License
905 stars 47 forks source link

True keyboard mode #17

Open Tenchi2xh opened 7 years ago

Tenchi2xh commented 7 years ago

Something I felt terribly missing from the original Pico8 was the lack of true keyboard support. I had tons of ideas that I could just not implement because there was no real keyboard input (create a tiny terminal, text adventure, an OS etc.)

Could it be possible to have a true keyboard mode, either activated programatically or with an environment variable?

That would effectively extend PX8 to be a Fantasy Microcomputer in addition to a Fantasy Console!

hallucino commented 7 years ago

Have you some example to have a better understanding ?

Tenchi2xh commented 7 years ago

Basically a mode where when you boot, you don't have 2 joypads, but instead each key on the keyboard is a different event.

For example, instead of btn(4) and btn(5) being the two buttons on the controller for example, btn(n) would represent the key of ASCII n being pressed.

Tenchi2xh commented 7 years ago

So if I want to make a game where you move using the W A S D keys (Z Q S D in France I think) I would have something like (in Python):

if btn(119):   # or more easily btn(ord('w'))
  # go up
elif btn(115):
  # go down
...
hallucino commented 7 years ago

It seems a good idea, I need to figure out how to do that

hallucino commented 7 years ago

You could try this feature with: btn('a') or btnp('a') for example, it should work with python

hallucino commented 7 years ago
hallucino commented 7 years ago

@Tenchi2xh do you want to test it ?