Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

Keep pressing button

Status
Not open for further replies.
I need a script which, if you hold pressed one button, it continues to gave the value of that button pressed.
To make an example, if you make an ABS you can make a gun: you press, a shot. But if you want to make a machine gun, if you press the button and keeps it pressed, it will shoot only one shot...I want it returnes the value every 0.2 seconds.
 
Dargor and loler12 are both incorrect

Dargor the x needs to be capitalized

loler12 the same goes for you and that code will never execute unless you create an object of that lass and invoke the Buttons method (also method names should not be capitalized see the conventions tutorial in my signature)

the correct line should be this

Code:
Input.press?(Input::BUTTON) or Input.repeat?(Input::BUTTON)

where BUTTON is one of the following

Code:
DOWN LEFT RIGHT UP 
Numbers corresponding to the directions down, left, right, and up.

A B C X Y Z L R 
Numbers corresponding to the various controller buttons.

SHIFT CTRL ALT 
Numbers directly corresponding to the keyboard's SHIFT, CTRL, and ALT keys.

F5 F6 F7 F8 F9 
Numbers corresponding to the keyboard's function keys. The other function keys are reserved by the system and cannot be obtained.

I would write more but your request is not clear enough
 
Status
Not open for further replies.

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top