playMaker

Author Topic: Tap to Move  (Read 7091 times)

berir

  • Playmaker Newbie
  • *
  • Posts: 25
Tap to Move
« on: February 26, 2014, 06:40:14 PM »
Hey Guys ,
first off I d love to say hi to everyone I have just joined playmaker forum...
manly because I am an artist not a coder and hope that this will greatly help me
speed up my game design process ...

I have been playing a bit with this tool and have to say it looks fantastic even though I am not quite familiar with it yet ...

anyway I am working on IOS game for ipad, a tower defence style game something  like a kingdom rush, where beside building your turrets, you also have a  Heroes character to help you defend as well…

I would like to be able to move my Hero character on the map, but not with a virtual joystick nor any kind of buttons, but by first selecting a character then a single touch anywhere on the screen to send  a character to that location…

I would greatly appreciate if someone could  point me to a good tutorial on how to create in playmaker " tap to move to the point of the finger" controller .....

Thank you so much in advance

Beri

berir

  • Playmaker Newbie
  • *
  • Posts: 25
Re: Tap to Move
« Reply #1 on: February 27, 2014, 12:40:53 AM »
I have found this tutorial
Using mouse pick which is fantastic and what I really want... but will it work on ipad /IOS device ... will the mouse click be recognised as touch/tap

please any help is welcome thanks in advance

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Tap to Move
« Reply #2 on: February 27, 2014, 03:42:31 AM »
Hi,

Give me few days and I'll do a working sample.

 Can you bump me beginning of next week? thanks.

bye,

 Jean

berir

  • Playmaker Newbie
  • *
  • Posts: 25
Re: Tap to Move
« Reply #3 on: February 27, 2014, 01:39:43 PM »
thank you Jean so much for that..... looking forward to it  ;D :)


the idea is that you have 2 characters or more so you have to  first select one of the characters that you wish to move,and then tap somewhere on the screen in order to move that particular character to that location ....
« Last Edit: February 27, 2014, 01:54:18 PM by berir »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Tap to Move
« Reply #4 on: March 04, 2014, 08:00:57 AM »
Hi,

 before I go there, have you checked the mecanim samples. one script does that already.

http://hutonggames.com/playmakerforum/index.php?topic=2603.0

bye,

 Jean

berir

  • Playmaker Newbie
  • *
  • Posts: 25
Re: Tap to Move
« Reply #5 on: March 04, 2014, 11:47:08 PM »
thanks Jean,

 I don't have a problem making a single character follow to the taped location... there are quite a few  good tutorials on that subject ...

what I don't understand is how is Having more then one characters handled (rpg  , turn based style ).

if I have 3 characters on my screen, selecting one and telling it to move to the tapped location, then selecting 2nd character and so on ....

every tutorial I have seen assume that we have only one character and it is already selected ...I am new to  Playmaker and still find it quite confusing

so basically what I really need is to see how is selecting and moving several characters handled...

also that leads me to my 2nd question are there any tutorial on turn based game in Playmaker?

Thank you in advance
« Last Edit: March 04, 2014, 11:58:35 PM by berir »

berir

  • Playmaker Newbie
  • *
  • Posts: 25
Re: Tap to Move
« Reply #6 on: March 05, 2014, 02:24:46 AM »
Hey Jean been brainstorming whole morning and thinking how could that be handled...

is this something done wit Tags?
 ...like creating selected and unselected tags... then setting character to either selected and unselected depending on their current state ...

so basically in my FSM before moving character to the tapped location should I be checking if the tag of that character is called for this instance Selected and  if not then just send it back to idle ????

Please let me know if this would be a good way to do this thanks

Beri
« Last Edit: March 05, 2014, 02:26:19 AM by berir »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Tap to Move
« Reply #7 on: March 06, 2014, 12:08:17 AM »
Hi,

 Yeah something along that. Typically I would solve it this way:

 your tp system is indepedant and it moves a dummy gamobject where you tapped. this works as is even with nothing else in the scene.


thenm that system fires a global event "REFRESH TAP TARGET" or something, you broadcast that global event so you do't care who's catching it.

then each of your character will received that global event and your character MUST know if it's his turn or not and if it is act upon it else simply goes to a idle state and carry on as usual.

does that make sense? if you understand this, you will get very far in building complex behavior in a simple way.

bye,

 Jean

berir

  • Playmaker Newbie
  • *
  • Posts: 25
Re: Tap to Move
« Reply #8 on: March 06, 2014, 06:01:21 AM »
Hi Jean,
 thank you for your reply, based on what you said I have designed something... please can you look at it, and let me know if this was a way of doing it ...
this actually works... but it feels very inefficient way of doing it ....
it must be better way ...
« Last Edit: March 06, 2014, 06:56:18 AM by berir »

berir

  • Playmaker Newbie
  • *
  • Posts: 25
Re: Tap to Move
« Reply #9 on: March 06, 2014, 06:02:04 AM »
Input Manager

berir

  • Playmaker Newbie
  • *
  • Posts: 25
Re: Tap to Move
« Reply #10 on: March 06, 2014, 06:05:57 AM »
Click Manager

the reason this works is because I have only 2 characters in my game,
but what if I had party of 6 or more ... ???? my Fsm would be huge
I feel that this cant be correct way to deal with case such as this  ... even though it works

I was thinking of using something like swapping tags , but I don't know how to use them... swap tag action looked confusing and it did not make any sense to me...  but again I believe my problem lies when I need to store object in Mouse Pick action ....

is there an action that does same outside Mouse pick action , I mean store game object ... if my last state could rename this game object into something else
then I could easily go back again into my very first state and close the loop..
then my new picked object in mouse pick action would not have same name as the one currently selected and my problem would have been solved

thanks in advance, looking forward to your reply



sorry for my spelling ...English is my 2nd language
« Last Edit: March 06, 2014, 06:55:20 AM by berir »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Tap to Move
« Reply #11 on: March 06, 2014, 07:35:58 AM »
Hi,

 yes, you are not far, but definitly going wrong with the tagging.

 all your players are tagged the same, it's only a good way to narrow down the search when "finding" a player.

 fire a global event, each player receives it, and only one of them is "active" as in shoudl react this event.

and so typically, since in your game only one actor can be active at a time, keep track of this with a global variable, a gameobject set to the current active player.

when you receive the global event, you compare your own gameobject ( using get owner) with the global variable, if it matches then you proceed, else you bail.

 EVEN BETTER, only send event to thet global variable and this is much more efficient.

Nowm if you want to manage who's turn it is, you would maintain a list of your players ( using ArrayMaker, that you can find on the wiki) or simply using the gameobject name as a way to select the next gameobject like so:

player 1
player 2
player 3
player 4

maintain a global int  set to 1 by default

compose the name using "build string" action, find that gameobject ( on top of filtering it by tag for efficiency) and then going to the next player is matter of increment this global int ( and set it to 1 when you reach 5).

 Does that make sense? lots of different ways to do this.

bye,

 Jean

berir

  • Playmaker Newbie
  • *
  • Posts: 25
Re: Tap to Move
« Reply #12 on: March 06, 2014, 08:15:40 AM »
thank you so much for that Jean, will try that and see how it goes

Beri