Simple Touch Problem

Hey everyone, this is a simple problem I am having here. 

I am using this joystick from SSK2: 

roaminggamer.github.io/RGDocs/pages/SSK2/libraries/easy_inputs/#onetouch

Which creates a joystick and allow the user to press where ever they want, and the joystick will appear there.

Now the problem is, when I try to press the “back” button to return to the menu, the joystick will just appear on top of it.

How do I have it so that when I press the back button, its touch listener calls and does not move the joystick? Thank you.

Show me how you are instantiating the joystick.  

Paste the code here.

Then I can help.

Your code should look something like this:

ssk.easyInputs.oneStick.create( sceneGroup, { debugEn = false, joyParams = { doNorm = true } } )

If you ‘think’ you are passing in a group as the first argument, verify it by printing it out first.

print("VERIFYING", sceneGroup)-- If this is 'nil' that is the problem. ssk.easyInputs.oneStick.create( sceneGroup, { debugEn = false, joyParams = { doNorm = true } } )
--ship.lua ssk.easyInputs.oneStick.create(group2, { joyParams = { doNorm = true, outerRadius = 85 } } ) --joystick related code -level.lua local player = ship.new(cameraGroup, UIGroup) --creates ship 

sceneGroup:insert(cameraGroup) sceneGroup:insert(UIGroup) --I pass two groups because this game also has a camera attached, the joystick needs to be in the UIGroup so it is not moved by the camera

including joystick

OK.

  1. Did you verify that group2 exists before passing it?

  2. Even if it does exist, if group2 is not inserted into the sceneGroup then when the scene changes, group2 is left behind.

  3. Every case where someone says “I changed scenes and the object was still drawn” always means the person is not inserting the object, group, or hierarchy of groups and objects into the scene group.

I find it weird that you’re creating the joystick in your player module. 

The joystick should be created when you create the level or scene.  That is the same place you would call the player module to create the player.

Actually managed to fix this one, I just set the back button to be within its own group.

Show me how you are instantiating the joystick.  

Paste the code here.

Then I can help.

Your code should look something like this:

ssk.easyInputs.oneStick.create( sceneGroup, { debugEn = false, joyParams = { doNorm = true } } )

If you ‘think’ you are passing in a group as the first argument, verify it by printing it out first.

print("VERIFYING", sceneGroup)-- If this is 'nil' that is the problem. ssk.easyInputs.oneStick.create( sceneGroup, { debugEn = false, joyParams = { doNorm = true } } )
--ship.lua ssk.easyInputs.oneStick.create(group2, { joyParams = { doNorm = true, outerRadius = 85 } } ) --joystick related code -level.lua local player = ship.new(cameraGroup, UIGroup) --creates ship 

sceneGroup:insert(cameraGroup) sceneGroup:insert(UIGroup) --I pass two groups because this game also has a camera attached, the joystick needs to be in the UIGroup so it is not moved by the camera

including joystick

OK.

  1. Did you verify that group2 exists before passing it?

  2. Even if it does exist, if group2 is not inserted into the sceneGroup then when the scene changes, group2 is left behind.

  3. Every case where someone says “I changed scenes and the object was still drawn” always means the person is not inserting the object, group, or hierarchy of groups and objects into the scene group.

I find it weird that you’re creating the joystick in your player module. 

The joystick should be created when you create the level or scene.  That is the same place you would call the player module to create the player.

Actually managed to fix this one, I just set the back button to be within its own group.