Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How does fire button work ? #28

Open
warpdesign opened this issue Jul 20, 2014 · 1 comment
Open

How does fire button work ? #28

warpdesign opened this issue Jul 20, 2014 · 1 comment

Comments

@warpdesign
Copy link

Reading the issues, it appears a fire button should appear when touching the right of the screen. The thing is when touching the right of the screen, the joystick appears and not the fire button.

I'm initializing virtualjoystick like this:

joystick = this.joystick = new VirtualJoystick({
container : document.getElementsByClassName('main')[0],
mouseSupport : true,
});

Is there anything else to do to have the firebutton ? How do I listen for firebutton presses ? Is there an equivalent to joystick.left() ? Maybe joystick.fire() ?

Thanks for the help.

@ssugar
Copy link

ssugar commented Aug 4, 2016

There isn't a built in fire button. You need to create a second joystick, constrain it's stick radius to 0, and use the touchstart event listener to detect touch events on that joystick. In that touchstart event listener, you'd then add whatever code you have to fire whatever you're looking to fire.

Look at https://github.com/jeromeetienne/virtualjoystick.js/blob/master/examples/dual.html to get a start on this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants