Skip to main content

On Sale: GamesAssetsToolsTabletopComics
Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines
0
Members

CLEAR COMMAND SELECTION

A topic by Badeorne created Aug 17, 2020 Views: 369 Replies: 3
Viewing posts 1 to 2
(2 edits)

How receive the input and replace Sup.Input.waskeyjustpressed()

   1.in normal script add an event who call a function and declare a var currentInput

document.addEventListener('keydown', thefunctioncall) ; var currentInput: string;

   2. In the fuction

function thefunctioncall(event: KeyboardEvent)
{ currentInput = event.key } // you can use keycode if you want number

3. in an update of a behavior just check what is press

update()
{ if(currentInput = "s"){Sup.log("you go down bro !")} }

4.Whit some work allow the player to choose the command he wish :D

By ussing a tab for exemple...

5. Be happy and send me money to iamamanipulator@devilinside.com

or just be happy.

Why do you want to avoid Sup.Input ? You just have to use in the update function of a behavior

if(Sup.Input.wasKeyJustPressed(“S”)){ // Do something }

You can use “ANY” if you want, to skip a cutscene for exemple.

if i choose the key i want in game. Doesn't want to make a "if" for each key. I search a way  to use Sup.Input.waskeyjustpressed() for that but don't find it. Sup.Input.getTextEntered() don't work for all key. So i use this event.