Messing with the Joystick Demo
DankStew
Member Posts: 36
Hey there fellow GameSalad users, I have been toying around with Codemonkeys' amazing Joystick Demo template. It's a great help to have something so useful already set up and working so I can dive right in and try to figure out the commands.
Which brings me to my question... is there a way that the joystick controls can be switched so that the moveable actor snaps back to center screen when not in use?
Would this be just setting up a boolean (touch.in.use) with a (move to: 0,0, scene) and have it say whenever the joystick is touched set to false (and true otherwise?).
Essentially I am trying to make it like an aiming system. Thanks!
Which brings me to my question... is there a way that the joystick controls can be switched so that the moveable actor snaps back to center screen when not in use?
Would this be just setting up a boolean (touch.in.use) with a (move to: 0,0, scene) and have it say whenever the joystick is touched set to false (and true otherwise?).
Essentially I am trying to make it like an aiming system. Thanks!
Comments
(slaps forehead)
Sorry, I think I wasn't clear about what I was trying to do. I meant to keep the actor that moves in the center (the red, blue, green and yellow circle). I want that to be a target that is controlled by the joystick.
I want that actor (the red, blue, green, and yellow circle) to snap back to center of scene if the joystick isn't currently moving it.
Thanks again for responding.
On the base of the joystick set controlling movement, add the rule
--Rule: If Event -> Touch -> is Pressed
----Change Attribute: game.Controlled = true
--Otherwise:
----Change Attribute: game.Controlled = false
Then in the beachball actor add the rule:
Rule: If Attribute game.Controlled is True
--(use the existing Move behavior)
Otherwise:
--Move To: (Coordinates for the center of the screen)
Essentially, the first place you touch on the screen becomes the centre of the joystick, and player movement is calculated in relation to that initial spot.
Take your finger off the screen and put it somewhere else and *that* then becomes the joystick centre... etc etc
There's a free version of Infinity Gene in case I'm not explaining myself well enough. You can find it here: http://itunes.apple.com/us/app/space-invaders-infinity-gene/id347875436?mt=8
It'd be really useful to know how to do this! I've tried a few experiments with it, but no luck. Mainly because I don't fully 'get' how the current joystick demo works. I just copy and paste
Cheers in advance!
QS
Dr. Sam Beckett never returned home...
Twitter: https://twitter.com/Quantum_Sheep
Web: https://quantumsheep.itch.io
@ QS: I can barely even copy and paste it sometimes!
So, anyone have any ideas on the 'finger as origin' joystick method I'm after? A lot of games use it now, and it helps keep the screen clear...
Cheers,
QS
Dr. Sam Beckett never returned home...
Twitter: https://twitter.com/Quantum_Sheep
Web: https://quantumsheep.itch.io
Change Attribute its position to the mouse position and then change attribute on the game attributes that rely on its position.
/is excited!!!
Dr. Sam Beckett never returned home...
Twitter: https://twitter.com/Quantum_Sheep
Web: https://quantumsheep.itch.io
Ok, the beginning bit (changing attribute to mouse position) is fine. I'd actually thought of that myself would you believe in my experiments!
It's the second bit. I'm not sure which attributes I should be changing, and to what, exactly...
Any further input at all?
/stores up some excitement just in case
Cheers!
QS
Dr. Sam Beckett never returned home...
Twitter: https://twitter.com/Quantum_Sheep
Web: https://quantumsheep.itch.io
Has anyone else got this working at all? (where you touch the screen as joystick origin thingy). It would be invaluable for those of us doing top-down shooters.
Those who've played one of the games I'm working on have all commented that the joystick sometimes obscures their view of the action, and if I'm honest, I have to agree with them (though you do get used to it).
This would certainly help alleviate the issue though.
Any help would be appreciated!
Cheers,
QS
Dr. Sam Beckett never returned home...
Twitter: https://twitter.com/Quantum_Sheep
Web: https://quantumsheep.itch.io
And nope, I just need one joystick for now! (can you implement four in future? j/k).
I'm at work with another 4.5 agonising hours till I get home. Looking forward to trying it out.
Again, thank you. This kind of stuff is way beyond my simple sheep brain and is way helpful, giving our games a bit more polish I reckon!
Cheers!
QS
Dr. Sam Beckett never returned home...
Twitter: https://twitter.com/Quantum_Sheep
Web: https://quantumsheep.itch.io
I probably want to include this, if I ever find time to start coding a game. Is there a tutorial for this moving control somewhere, so I can recode and fully understand it? If not, maybe someone is willing to write one..?! Would love to see that. :-P
/Watches clock
Dr. Sam Beckett never returned home...
Twitter: https://twitter.com/Quantum_Sheep
Web: https://quantumsheep.itch.io
Sorry. I actually wanted to say: it's so f***ing amazing, it totally blew me away!1!11
Hope that helps. ;-)
Dr. Sam Beckett never returned home...
Twitter: https://twitter.com/Quantum_Sheep
Web: https://quantumsheep.itch.io
is that still a factor?
It works pretty well. There's a slight 'jump' that the player actor does when you take your finger off and put it back on. I'm wondering if you could put in a rule that says 'don't move the actor if finger is released' or something...
Still, thanks! It certainly helps! And my dad could actually play the game, where before he just got confused.
Bless 'im!
QS
Dr. Sam Beckett never returned home...
Twitter: https://twitter.com/Quantum_Sheep
Web: https://quantumsheep.itch.io
Great work, and thanks again!
AND
adding images to the direction (left,right,diagonal left or right up or down etc)?
Thanks
i love the controls and i want to use that style in my next game but i want to have the player stay facing the direction they where moving.kind of a gauntlet style.
http://img690.imageshack.us/i/screenshot20110114at112.png
Insert this code in your controlled actor. You should already have the Constrain rotation behavior you just need to add the rest.
thanks
1. You have to start with CodeMonkey's joystick demo.
2. The scene we are looking for is Game1Control (but this can be applied to any).
3. Find the "Move Me 1 Control" actor and double-click it to open it. among the rule you will find a Constrain attribute on rotation:
4. Create a rule around it that say When attribute "game.Stick1Grabbed" = true:
5. Open the otherwise tab and add two Change attributes. The first is Change attribute "self.Rotation" to "game.Angle". The second is Change attribute "self.Motion.AngularVelocity" to "0".
It works for me.
Thanks again for your help.
Thrstn