Gb-studio: Attach button moves player

Created on 22 Aug 2020  路  5Comments  路  Source: chrismaltby/gb-studio

attaching script to button doesn't disable player movement in 2.0 beta

i used the player as a cursor to make a menu incrementing a variable by one then setting players actor position when a dpad right is pressed, the player sets the position but then keeps moving from position until the dpad is lifted and pressed again

this is in 2d top down mode

win 10 64 bit
2.0 beta

project attached

Bakers Life.zip

bug

Most helpful comment

I would personally love to see the checkbox of option 3 so that you can choose whether to disable the default behaviour of the buttons when attaching scripts. This would be especially handy for the "A" button, which is the "interact" button. Currently, in order to attach a script to the "A" button and also replicate something similar to interacting, you have to check if a player is in a specific position relative to the object you want to interact with, check if they are facing the direction of the object, then "attack" the object with a completely transparent sprite, triggering an event with the "On Hit" section of the object. That's kinda clunky, but it works. It would be much easier, though, to just have that checkbox that allows me to not disable the default behaviour of the "A" button but still be able to attach a script to it.

All 5 comments

Ways to address this issue

  1. Call it a feature, break some peoples games...
  2. When attach script is assigned to a button, Disable default for topdown 2d
  3. Another checkbox for Joypad: attach script to button, Disable default action, all modes?

Checkbox would be quite nice, but would need migration from 2.0 beta1 and 1.2.1 projects?

Note this is slightly related to #457 (joypad script fire on scene load button held) and #468 (joypad script fire after dialogue close)

@RichardULZ I'd be interested in a fourth option to address this:

  1. Events to disable/re-enable the default functionality of individual buttons, ideally implemented with a selector that lets you select all the affected buttons in at once.
    In addition to solving this issue while also allowing default inputs during scripts when desired, it would be useful for things like disallowing the player from moving in a particular direction (e.g. not letting the player move left during a chase sequence).

@eishiya gbs 1.2.1 had mode 3 all the time without a checkbox, If you wanted to disable the default action, you would just use an empty "attach script to joypad", and you couldn't use it until it was detached.

So it might not be necessary to have another event, depends on how the fix is implemented.

I think the issue is from the change to run things synchronously,
The previous side effect of disabling input was caused by only being able to run 1 script at a time, and never allowing player movement during a script, along with previous joypad buffers which were changed (causing the other issue).

I would personally love to see the checkbox of option 3 so that you can choose whether to disable the default behaviour of the buttons when attaching scripts. This would be especially handy for the "A" button, which is the "interact" button. Currently, in order to attach a script to the "A" button and also replicate something similar to interacting, you have to check if a player is in a specific position relative to the object you want to interact with, check if they are facing the direction of the object, then "attack" the object with a completely transparent sprite, triggering an event with the "On Hit" section of the object. That's kinda clunky, but it works. It would be much easier, though, to just have that checkbox that allows me to not disable the default behaviour of the "A" button but still be able to attach a script to it.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Veund picture Veund  路  3Comments

darkhog picture darkhog  路  6Comments

josefnpat picture josefnpat  路  4Comments

meaninglessname picture meaninglessname  路  5Comments

mrcampbell picture mrcampbell  路  5Comments