• Dear Cerberus X User!

    As we prepare to transition the forum ownership from Mike to Phil (TripleHead GmbH), we need your explicit consent to transfer your user data in accordance with our amended Terms and Rules in order to be compliant with data protection laws.

    Important: If you accept the amended Terms and Rules, you agree to the transfer of your user data to the future forum owner!

    Please read the new Terms and Rules below, check the box to agree, and click "Accept" to continue enjoying your Cerberus X Forum experience. The deadline for consent is April 5, 2024.

    Do not accept the amended Terms and Rules if you do not wish your personal data to be transferred to the future forum owner!

    Accepting ensures:

    - Continued access to your account with a short break for the actual transfer.

    - Retention of your data under the same terms.

    Without consent:

    - You don't have further access to your forum user account.

    - Your account and personal data will be deleted after April 5, 2024.

    - Public posts remain, but usernames indicating real identity will be anonymized. If you disagree with a fictitious name you have the option to contact us so we can find a name that is acceptable to you.

    We hope to keep you in our community and see you on the forum soon!

    All the best

    Your Cerberus X Team

noBug [SOLVED] Input bug? Keyboard keys keep switching from 1 to 0 vice versa when keydown is pressed

Amon

Member
Joined
Nov 19, 2018
Messages
88
Hi guys.

I'm getting input jitters when holding keydown. Best way to describe it is with this code. Code is bare minimum. The image jitters when keydown (key) is pressed and when checking it using DrawText("" + KeyDown(KEY_LEFT), 0, 0), it shows it switching from 1 to 0 to 1 etc.


[edit] Ok, it's not a bug. It's my keyboard. After unplugging it and plugging it back in the issue has not returned. I guess I'll be getting new keyboard tomorrow.


Cerberus:
Strict
Import mojo

Function Main:Int()
    New Game()
    Return 0
End

Class Game Extends App
    Field x:float
    Field y:float
    Field speed:float
    Field image:Image
    'summary:The OnCreate Method is called when mojo has been initialized and the application has been successfully created.
    Method OnCreate:Int() 
        'Set how many times per second the game should update and render itself
        SetUpdateRate(60)
      
        image = LoadImage("yellowtile.png", 1)
        speed = 3
        x = 400
        y = 300
        Return 0
    End
  
    'summary: This method is automatically called when the application's update timer ticks.
    Method OnUpdate:Int()
        If KeyDown(KEY_LEFT)
            x -= 2
        EndIf
        If KeyDown(KEY_RIGHT)
            x += 2
        EndIf
        Return 0
    End
  
    'summary: This method is automatically called when the application should render itself, such as when the application first starts, or following an OnUpdate call.
    Method OnRender:Int()
        Cls()
        DrawImage(image, x, y, 0)
        DrawText("KEYLEFT " + KeyDown(KEY_LEFT), 0, 0)
        DrawText("KEYRIGHT " + KeyDown(KEY_RIGHT), 0, 10)
        Return 0
    End

    'summary: This method is called instead of OnRender when the application should render itself, but there are still resources such as images or sounds in the process of being loaded.
    Method OnLoading:Int()
      
        Return 0
    End
  
    'summary: This method is called when the application's device window size changes.
    Method OnResize:Int()
      
        Return 0
    End
  
    '#REGION Code to handle susped status of the game goes here
  
    'summary: OnSuspend is called when your application is about to be suspended.
    Method OnSuspend:Int()
  
        Return 0
    End
  
    'summary: OnResume is called when your application is made active again after having been in a suspended state.
    Method OnResume:Int()
      
        Return 0
    End 
    '#END REGION
  
    '#REGION Code to handle game closing goes here:
  
    'summary: This method is called when the application's 'close' button is pressed.
    Method OnClose:Int()
              
        Return Super.OnClose()
    End

    'summary:This method is called when the application's 'back' button is pressed.
    Method OnBack:Int()

        Return Super.OnBack()
    End
  
    '#END REGION

End
 
Last edited:
Back
Top Bottom