Posted: 2nd Jan 2022 21:49
Hi,

I am wondering what everyone thinks of reusing buttons for different stuff. What I mean by that is instead of
+ Code Snippet
	AddVirtualJoystick(OBJECT_ID_JOYSTICK, JOYSTICK_X, JOYSTICK_Y, JOYSTICK_SIZE)
	AddVirtualButton( OBJECT_ID_JOYSTICK_BUTTON_BUY, JOYSTICK_BUTTON_BUY_X, JOYSTICK_BUTTON_BUY_Y, JOYSTICK_BUTTON_BUY_SIZE )
	SetVirtualButtonText(OBJECT_ID_JOYSTICK_BUTTON_BUY, "Buy")
	AddVirtualButton( OBJECT_ID_JOYSTICK_BUTTON_START, JOYSTICK_BUTTON_START_X, JOYSTICK_BUTTON_START_Y, JOYSTICK_BUTTON_START_SIZE )
	SetVirtualButtonText(OBJECT_ID_JOYSTICK_BUTTON_START, "Start")


I do
+ Code Snippet
	AddVirtualJoystick(OBJECT_ID_JOYSTICK, JOYSTICK_X, JOYSTICK_Y, JOYSTICK_SIZE)
	AddVirtualButton( OBJECT_ID_JOYSTICK_BUTTON_A, JOYSTICK_BUTTON_A_X, JOYSTICK_BUTTON_A_Y, JOYSTICK_BUTTON_A_SIZE )
	SetVirtualButtonText(OBJECT_ID_JOYSTICK_BUTTON_A, "Buy")
	AddVirtualButton( OBJECT_ID_JOYSTICK_BUTTON_B, JOYSTICK_BUTTON_B_X, JOYSTICK_BUTTON_B_Y, JOYSTICK_BUTTON_B_SIZE )
	SetVirtualButtonText(OBJECT_ID_JOYSTICK_BUTTON_B, "Start")

Is creating individual buttons for one offs considered good or bad?
Posted: 4th Jan 2022 8:24
There is no good or bad, 1 button can only perform 1 task and the ID can be used once, I think your question is more of a code management issue, what to name your constants and variables because the reality is you CAN only use the actual button once for a single task, but yeah sure reuse its ID when its been destroyed, this all depends on your requirements and scene setup.