Skip to content
View in the app

A better way to browse. Learn more.

LCPDFR.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Key Detection Problems

Featured Replies

Hi, i hate posting so soon after my other thread but i just can not get Game.IsKeyDown() to work. I have it detect if the key is pressed (Y) while a bool is active which is only active while a timer is on. I have tried with just the IsKeyDown method but it still will not work. I have tried in a normal process, in a while loop and in a new Game Fiber. Could anyone see if i'm doing anything wrong? 

Here's a pic of the relevant code (I have highlighted the area with game.iskeydown) : http://s30.postimg.org/k4x1ii6o1/jpg.png

I had to upload it as LCPDFR.com would not allow me to upload pictures, and neither would imgur :pinch:

 

 

Edit: Do you think it has anything to do with this? It seems to be looping throught the 'Key Not pressed' code more and more every time it's run http://s21.postimg.org/g3ubu2tyf/adding.jpg

 

Edited by AnIdioticMonkey

  • Author
41 minutes ago, LtFlash said:

Try to insert "break;" after "toAcceptTimer.Enabled = false;" It will stop the while(true) loop so the control will return where it should be.

Unfortunately that does not work, it still waits before the timer elapses before displaying we haven't pressed the key but the Game.iskeydown never returns true

 

Edit: Do you think it has anything to do with this? It seems to be looping throught the 'Key Not pressed' code more and more every time it's run http://s21.postimg.org/g3ubu2tyf/adding.jpg

Edited by AnIdioticMonkey

Definitely, it should not happen but I don't see a reason why it is so. You can put the while(true) into new fiber like that:

GameFiber.StartNew(delegate
            {
                while (true)
                {
                     //
                    GameFiber.Yield();
                }
            }
            );

and see what happens.

  • Author
53 minutes ago, LtFlash said:

Definitely, it should not happen but I don't see a reason why it is so. You can put the while(true) into new fiber like that:

GameFiber.StartNew(delegate
            {
                while (true)
                {
                     //
                    GameFiber.Yield();
                }
            }
            );

and see what happens.

Have an internet high five! You fixed it and it now works perfectly, thank you! I'm sure i have already tried the gamefiber approach but maybe it failed because i didn't have the break; ? Anyway, thank's for all your help!

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

Similar Content

Recently Browsing 0

  • No registered users viewing this page.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.