Topic:   New key functions, updates for SC v2.0b3   (Read 10462 times)


0 Members and 1 Guest are viewing this topic.

GMG Mike


  • Administrator

  • GMG-er

  • *****

  • no avatar

  • Posts: 536
    • mikerichardson.name
New key functions, updates for SC v2.0b3
« on: November 28, 2010, 10:32:09 PM »
The following new key functions have been added for SilverCreator v2.0b3:

TABKEY
UPKEY
DOWNKEY
LEFTKEY
RIGHTKEY
SPACEBARKEY

The function returns true if the respective key is held down. They work like the existing functions SHIFTKEY, OPTIONKEY, etc. This means you can check if the space bar is being held down in a timer, and then fire the gun, instead of relying on the inaccurate/dodgy Key Down event.

Note that the Key Down even will still fire if you press any of those keys (Tab, Space, Up, Down, Left, Right). You will need to rewrite your code to move the key check from Key Down, and into your timer.

These keys were chosen because they generally have the same position on all keyboards (German, Japan, etc). Other keys are harder to support because they change positions.

GMG Mike


  • Administrator

  • GMG-er

  • *****

  • no avatar

  • Posts: 536
    • mikerichardson.name
Re: New key functions, updates for SC v2.0b3
« Reply #1 on: November 28, 2010, 10:35:43 PM »
Key Function Updates

OPTIONKEY is only supported on Macintosh. It will always return FALSE on Windows. Previously, it may have retuned an unexpected value on Windows. If you are making a cross platform game you should not even use it at all.

Mac keyboards label the Option key as "alt" - but the actual position of the Alt key on PC keyboards is where Mac keyboards place the "Command" key.

Therefore, COMMANDKEY is now to be used on Windows to check for the ALT key.

The Control key works the same on both platforms and is unchanged.

Silverwind


  • ^ This guy is amazing.

  • ****


  • Posts: 2805

  • For the glory of my maker
Re: New key functions, updates for SC v2.0b3
« Reply #2 on: November 29, 2010, 04:35:26 AM »
Dynamic value checking is awesome!
I survived the spammage of 2007

Connors


  • ^ This guy is amazing.

  • ****


  • Posts: 2374

  • It's a secret to everyone...
Re: New key functions, updates for SC v2.0b3
« Reply #3 on: December 05, 2010, 01:50:45 PM »
So, um, when is this gonna be available? *frownyface*
Warning: The above post may have been modified multiple times.

"In a great game, the character must never perfectly obey the user's command"
 - Tim Rogers

http://connorspuzzles.tumblr.com/

Xiphos


  • GMG-er

  • **


  • Posts: 676
Re: New key functions, updates for SC v2.0b3
« Reply #4 on: December 05, 2010, 05:28:57 PM »
When b3 is released.

Connors


  • ^ This guy is amazing.

  • ****


  • Posts: 2374

  • It's a secret to everyone...
Re: New key functions, updates for SC v2.0b3
« Reply #5 on: December 05, 2010, 11:23:20 PM »
Yeah well maybe I'll stick with mouse control until I know I can use this for my contest game.
Warning: The above post may have been modified multiple times.

"In a great game, the character must never perfectly obey the user's command"
 - Tim Rogers

http://connorspuzzles.tumblr.com/

Gan


  • Administrator

  • ^ This guy is amazing.

  • *****


  • Posts: 4411
Re: New key functions, updates for SC v2.0b3
« Reply #6 on: December 06, 2010, 12:09:52 AM »
@Mike It'd be easier if you just put in a KeyUp method and forget the different key placement. If a programmer wants to make a aswd game, they should manually program in certain keyboard support.
In fact maybe you could make a variable that changes according to keyboad type. Then problem would be solved.

I'm pretty sure most of us are tired of jumpy key press movement.

Connors


  • ^ This guy is amazing.

  • ****


  • Posts: 2374

  • It's a secret to everyone...
Re: New key functions, updates for SC v2.0b3
« Reply #7 on: December 06, 2010, 06:31:26 PM »
I'd be fine with an update that has only the added key support and wait until later for some features.... But then that's mostly because I'm thinking about my own contest game. ::)
Warning: The above post may have been modified multiple times.

"In a great game, the character must never perfectly obey the user's command"
 - Tim Rogers

http://connorspuzzles.tumblr.com/