Hold down touch/mouse button and track finger drag on screen
Hi all
I'm working on a tank game where I want the turret that is an actor constrained to the tank to fire when the player holds on the screen and drags to destroy a target.
I have it so a mouse button selects a waypoint and when the button is released it moves the tank to its new X & Y position.
I want the firing mechanism to be activated by selecting a point and drag the players finger on screen, the turret would then automatically follow this movement and I can then get the tank shell firing every odd second.
Q: How to I get the hold down, touch and track the dragging finger position for the turret to follow?
Been bugging me all day and not getting far and been searching GS Forums but nothing close.
Thanks in advance guys.
It takes a Zombie to know a Zombie!!!
Comments
Use a Constrain Attribute action, self.Rotation To vectorToAngle( self.Position.X - game.Mouse.Position.X , self.Position.Y - game.Mouse.Position.Y )
Universal Binary Template - Universal Binary Template Instructions Rev 4 (Short) - Custom Score Display Template
Hi Colander,
It takes a Zombie to know a Zombie!!!
I don't know without looking at your game. Put it in there and play with it until it works how you want. I did notice in my test project it wouldn't work in a rule with "When touch is pressed" but "When mouse button is down" did work.
Universal Binary Template - Universal Binary Template Instructions Rev 4 (Short) - Custom Score Display Template
ok, cool will give it a try...thanks again
It takes a Zombie to know a Zombie!!!
How do you register a hold mouse button down like when you hold your finger down on the screen?
It takes a Zombie to know a Zombie!!!
i want it so that if the player holds down their finger it locks in the tank position x and y but if the player just tap on the screen the TANKFIRE attribute is true and it fires a shell.
I can't seem to get the hold down part nailed down as when you press and hold down on the screen (mouse button down) to lock in the waypoint, GS thinks your tapping the screen and it fires.
How can I separate the movement and the fire rules? been driving me crazy!!!
It takes a Zombie to know a Zombie!!!
Use "When touch is released" to fire it.
Universal Binary Template - Universal Binary Template Instructions Rev 4 (Short) - Custom Score Display Template
that doesn't work...
I have a rule that locks the waypoint - this is when the player touches the invisible actor that covers the screen...this then locks the x and y and the tank moves to that wayoint....i've got that working.
Now, when I touch the invisible actor that covers the screen, the tank fires?
i've added a rule saying
i've touch is released, then change attribute 'TANKFIRE' to true. When you tap on the invisible actor to select a new waypoint, the tank fires anyway?
Any glues?
It takes a Zombie to know a Zombie!!!
Not without working on the project, maybe a fire button on your HUD.
Universal Binary Template - Universal Binary Template Instructions Rev 4 (Short) - Custom Score Display Template
Yeah I think that would be easier but really wanted to have multi touch control without clunky on screen joysticks and such.
Oh well, might have to rethink this one.
It takes a Zombie to know a Zombie!!!
Does anyone know a good template for using touch gestures with Gamesalad?
It takes a Zombie to know a Zombie!!!
Does the attached demo help?
Hi RThurman
Yeah, thats nearly there...will use this to get started on the movement.
Thanks for your help on this one...been driving me loopy for a few days now.
Think this will really help!
It takes a Zombie to know a Zombie!!!