Anybody know how to go about a Joystick that appears where you touch, such as in agar.io?
ElDalton
Member Posts: 21
I have the joystick made, however i'd like it to appear on the players fingers wherever they touch the screen as long as it's on the left half. This is similar to the popular game agar.io (picture for reference)
Anybody have an idea on how to go about this? I have the joystick made and fully functional, however I'm having problems with making it appear and disappear depending on the players touch and having it function. Thanks!
Comments
Try this:
Where would I put this code? Inside my joystick?
That depends on how you have built the joystick. But you might as well try it and see what happens.
Be sure to test this out on a separate experimental copy of your working game. Just in case it gets messy! Then you don't have to try to fix anything if it turns into a mess. You just go back to your good working copy.
Try this:
On touch press, spawn joystick actors.
On touch release, destroy joystick actors.
If you have 2 (or more) joysticks, just make a rule to spawn joysticks over another actor put in the background. There are so many ways to do this.
Good luck!
I have a template that does this. I can't link it now but check http://www.armelline.com, in the snippets section.
Contact me for custom work - Expert GS developer with 15 years of GS experience - Skype: armelline.support
I tried this beforehand, for it seemed like the simplest explanation. However, When the player puts his finger on the screen, the joystick appears right where the players finger is but it doesn't "connect" or "identify" with the players touch to allow it to move around. The player would have to lift their finger up and place it back down (which wouldn't work considering in the final product the joystick will disappear again when the finger is lifted)
Did you try @RThurman's suggestion ? I think it should work just fine ?
Yes I tried, didn't work out too well. My joystick is split into two actors, the background circle that the joystick is contained in and the joystick itself. When trying to do this with both actors it just kinda goes crazy.
//
First, I would suggest that it actually worked. That is, it showed up in the right place just like you asked.
Now you need to figure out how to make the actual joystick mechanics work based upon a new location. "Crazy" isn't too helpful of a description. You now need to describe how hour joystick is set up and what is causing it to go "crazy" now that it is in a new location. For example, perhaps you have noticed that using the constrain behavior does not work well when the joystick is going to new random locations.
It really sounds like my demo does exactly what you want. Did you try it?
Contact me for custom work - Expert GS developer with 15 years of GS experience - Skype: armelline.support
@Armelline -- Curiosity is getting the best of me! But I am not able to find your demo. Could you supply a direct link?
Okay, well, yeah, erm, apparently when I last updated the site I removed it by accident...
My bad!
http://gshelper.com/shop/gamesalad-templates/armellines-templates/freedom-controller/
Contact me for custom work - Expert GS developer with 15 years of GS experience - Skype: armelline.support
@Armelline -- great demo!
Great job!
My GameSalad Academy Courses! ◦ Check out my quality templates! ◦ Add me on Skype: braydon_sfx
Yes I tried to find your demo before but couldn't, but just got it. This is exactly what I need, however there is an invalid path in the code when I play it and I cant figure out what the path is for me to transfer the demo and build it into my game? Its the first path in both the player and the indicator.
The only attributes used are game.Touch X and game.Touch Y so it's probably those. You'll need to reference the original demo to see where to replace each one.
Contact me for custom work - Expert GS developer with 15 years of GS experience - Skype: armelline.support
Whats variable that is the if for both actors? That's the variable that is coming up as invalid
game.Touch X and game.Touch Y
Contact me for custom work - Expert GS developer with 15 years of GS experience - Skype: armelline.support