Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

Simple Touch Problem
Started by Blex Jun 26 2018 04:32 PM

6 replies to this topic

Best Answer Blex , 27 June 2018 - 11:05 AM

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

[TOPIC CONTROLS]
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

Blex

[GLOBAL: userInfoPane.html]
Blex
  • Corona Geek

  • 1,197 posts
  • Corona SDK

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.

 

 



[TOPIC: post.html]
#2

roaminggamer

[GLOBAL: userInfoPane.html]
roaminggamer
  • Corona Geek

  • 7,380 posts
  • Corona SDK

Show me how you are instantiating the joystick.  

 

Paste the code here.

 

Then I can help.



[TOPIC: post.html]
#3

roaminggamer

[GLOBAL: userInfoPane.html]
roaminggamer
  • Corona Geek

  • 7,380 posts
  • Corona SDK

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 } } )


[TOPIC: post.html]
#4

Blex

[GLOBAL: userInfoPane.html]
Blex
  • Corona Geek

  • 1,197 posts
  • Corona SDK

--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


[TOPIC: post.html]
#5

roaminggamer

[GLOBAL: userInfoPane.html]
roaminggamer
  • Corona Geek

  • 7,380 posts
  • Corona SDK

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.



[TOPIC: post.html]
#6

roaminggamer

[GLOBAL: userInfoPane.html]
roaminggamer
  • Corona Geek

  • 7,380 posts
  • Corona SDK

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.



[TOPIC: post.html]
#7

Blex

[GLOBAL: userInfoPane.html]
Blex
  • Corona Geek

  • 1,197 posts
  • Corona SDK

  Best Answer

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




[topic_controls]
[/topic_controls]