Virtual Joystick

Apprentice
Posts: 5
Joined: 2012.04
Post: #1
Hello All,
Does anyone know of a good way to implement a virtual joystick without using Cocos2D and SneakyJoystick

Thanks
Quote this message in a reply
Moderator
Posts: 916
Joined: 2002.10
Post: #2
use sneaky joystick in cocos2d?

I mean it's pretty straight forward. you attach it to your scene, and then you just read the vector from it.

Not sure what else you need to know or want to know. If you're asking a design question, that's something entirely different.
Quote this message in a reply
Apprentice
Posts: 5
Joined: 2012.04
Post: #3
I cannot include the cocos2d framework I need an individual class and I am not quite sure how to get it done ive been looking at sneakys but everything relates to the cocos framework.
Quote this message in a reply
Moderator
Posts: 916
Joined: 2002.10
Post: #4
I know justinfic just recently implemented a virtual joystick for his game kung fu killforce. maybe if I can somehow summon him here
Quote this message in a reply
Member
Posts: 338
Joined: 2004.07
Post: #5
(Apr 5, 2012 03:57 PM)skyhawk Wrote:  I know justinfic just recently implemented a virtual joystick for his game kung fu killforce. maybe if I can somehow summon him here

YOU RANG....? Ninja

I do indeed have my own virtual joystick. I do not use Cocos2D-- it's all hand rolled stuff. What specifically do you want to know?

Justin Ficarrotta
http://www.justinfic.com
"It is better to be The Man than to work for The Man." - Alexander Seropian
Quote this message in a reply
Apprentice
Posts: 5
Joined: 2012.04
Post: #6
I am just looking for an easier way to implement a virtual joystick... If you wouldn't mind I would like to take a look at your joystick class and maybe understand the process a little more.
Quote this message in a reply
Member
Posts: 338
Joined: 2004.07
Post: #7
The functionality is spread across a bunch of classes in the engine-- if you're looking for an all-in-one solution you'd be better off with the cocos joystick. I've been told my engine is pretty lovecraftian.

Design-wise, at its simplest you just want to have a center point on screen (around which your joystick is drawn), then within a certain radius of that, track the user's touch position and get a vector going from the center to the touch pos. Normalize that vector, and you'll get an input range of -1 to 1 in the x and y directions.

Justin Ficarrotta
http://www.justinfic.com
"It is better to be The Man than to work for The Man." - Alexander Seropian
Quote this message in a reply
Member
Posts: 446
Joined: 2002.09
Post: #8
Like others I've rolled my own (closed source, sorry). These aren't difficult to get going, but there are a lot of usability issues you need to consider. There's a really good article about virtual sticks here: http://www.gamasutra.com/view/feature/13...ooter_.php

My personal preference are dynamic sticks that appear centred on the first touch, then follow your thumb if you go beyond the radius. These feel better than static sticks since a swipe greater than the radius in the opposite direction *always* changes direction, no matter how far your thumb may have wandered from the original start point. The game doesn't even have to draw these or call them "sticks". It becomes a more natural "touch and swipe to move" interface. This setup might not work for every game, but the less you try to emulate physical controls the better IMHO.
Quote this message in a reply
Member
Posts: 338
Joined: 2004.07
Post: #9
Nice, that article is excellent, although I think it makes an assumption that the first touch should always be zeroed-- as if you were touching your thumb to an analog stick-- and that the player always wants to tap-and-swipe to initiate movement.

Personally, my joysticks stay visible centered around one point, but the touch region is quite a bit bigger than the joystick on-screen and the radius for tracking the finger once you touch it is huge. And I do like tapping on the edge of a joystick for quick instant movement in that direction without having to swipe.

That said, I'm biased in that direction because my games tend to be VERY heavily based on twitch.

Quote:the less you try to emulate physical controls the better IMHO

This, a thousand times! While I do like evoking the feeling of old arcade controls (mine look and sound similar) I think mechanically you have to create something from the ground up for touchscreens.

Justin Ficarrotta
http://www.justinfic.com
"It is better to be The Man than to work for The Man." - Alexander Seropian
Quote this message in a reply
Moderator
Posts: 1,560
Joined: 2003.10
Post: #10
Slides from a GDC talk about this topic. Some interesting stuff in here. http://www.stfj.net/ControlsYouCanFeel-Z...DC2012.pdf
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Sound from both file and "virtual fs" godexsoft 1 2,266 Feb 14, 2012 08:33 PM
Last Post: godexsoft