pressUp
Release a button programmatically.
Analog joysticks are not supported at this time.
0.4.0
const nostalgist = await Nostalgist.nes('flappybird.nes')
nostalgist.pressUp('select')nostalgist.pressUp('start')nostalgist.pressUp('a')nostalgist.pressUp('left')nostalgist.pressUp('l')nostalgist.pressUp({ button: 'a', player: 2 }) // press the button "a" on player 2's controllerArguments
Section titled “Arguments”-
Section titled “options”optionstype:
string | { button: string, player?: number }If it’s a string, then it’s the same as
{ button: <options> }.If it’s an object, please see below.
-
Section titled “button”buttontype:
stringThe button you want to press. Can be:up,down,left,right,select,start,a,b,x,y,l,l2,l3,r,r2,r3.The ‘a’, ‘b’, ‘x’, ‘y’ buttons here use the SNES layout:
x
y a
b -
Section titled “player”playertype:
numberdefault:1The player you want to control.
If you want to control the player other than
1, make sure you have set a key binding for that player inretroarchConfigoption while launching. For example:await Nostalgist.launch({retroarchConfig: {input_player2_down: 'num3',input_player2_left: 'num2',input_player2_right: 'num4',// see https://github.com/libretro/RetroArch/blob/575859e5d76d921cb490f55afcd0bbca90d4a742/retroarch.cfg#L468-L483input_player2_up: 'num1',},/* ...other options */})Because we are using these key bindings to simulate the control.
-