playMaker

Author Topic: Tile Movement  (Read 4532 times)

Rabagast

  • Hero Member
  • *****
  • Posts: 683
    • Homepage
Tile Movement
« on: July 21, 2014, 06:59:43 PM »
Hi!
I'm trying to make a kind of tile movement. I have a space ship I can move horizontal. I try to use iTween Move Add and move the ship 20 pixels on the X-Axis.
And it works, but I need to wait until the iTween Move is finished before I can move it back. And here is the first question. How can I do this, so I can just move it right when it still moves to the left?

And question 2:
When I move to the left or right. I need to wait until iTween Move is finished and then released the move button and press it again to continue moving. How can I do this so I can move to to the end of left or right side without release the button and press it again?

Hope you understand what I mean?
And I will be very grateful if someone know any example of tile movement. Or can just help me with this. :)

Check out our homepage. http://www.walsberg.no
Or my personal game blog for news about my games. http://retro-tetro.walsberg.no

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Tile Movement
« Reply #1 on: July 30, 2014, 06:10:09 AM »
Hi,

 you should not be using iTween of that, but instead manually control everything.

 My first stop would be to study very carefully the m2h samples I ported to PlayMaker, in there you'll find various samples that I think will be very close to what you want.

https://hutonggames.fogbugz.com/default.asp?W887

 Bye,

 Jean

Rabagast

  • Hero Member
  • *****
  • Posts: 683
    • Homepage
Re: Tile Movement
« Reply #2 on: July 30, 2014, 11:53:48 AM »
Hi, Jean!

I'm looking at "Catch Eggs" example. The movement there is pixel by pixel.
But I want it to move 10 pixels. When I push the move left button and then release the button, the player object moves 10 pixels to the left. I don't know where I should go. Is it some more Actions I can add to the movement to do this?
Check out our homepage. http://www.walsberg.no
Or my personal game blog for news about my games. http://retro-tetro.walsberg.no

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Tile Movement
« Reply #3 on: July 31, 2014, 06:43:57 AM »
Hi,

 I see. then yes, iTween would work fine in this case. Each iTween actions have a "finish" event property to know when the tweening is finished, so this would be your key to make sure you don't process user input while tweening.

 Bye,

 Jean

Rabagast

  • Hero Member
  • *****
  • Posts: 683
    • Homepage
Re: Tile Movement
« Reply #4 on: July 31, 2014, 09:45:58 AM »
While I still have your attention, Jean. :)
This movement you use in "Catch Eggs", is this a good way to make a ladder movement also? Just change "Get Axis" to Vertical and "Translate" to Y.
I tried, and it works, but with some few bugs. I want to position the player at the center of the ladder. And also need to fix it so the player stop at the bottom of the ladder when it's grounded. Now it's still trying to walk down since the player still is in the ladder trigger. I think I can use a raycast to check that. I think I'm very close to make a good ladder movement. I will experiment more. :)
Check out our homepage. http://www.walsberg.no
Or my personal game blog for news about my games. http://retro-tetro.walsberg.no

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Tile Movement
« Reply #5 on: August 01, 2014, 06:19:42 AM »
Hi,

 Yeah, that would work to move your character up and down a ladder of course.


For positionning, you 'll have to adjust the code and even maybe implement an offset variable so that you can control the relative position of the player compare to the ladder itself.

 You'll need to create awareness of the situation for your logics. if the player is on a ladder then all fsm shoudl know about this somehow and not act as if it was on the floor. Either disable enable fsm's or account for that in each using some global events to move away from the supposed logic for a given fsm.

 Bye,

 Jean

Rabagast

  • Hero Member
  • *****
  • Posts: 683
    • Homepage
Re: Tile Movement
« Reply #6 on: August 01, 2014, 07:22:07 AM »
Hi!

So far it works very well, but I have a very big problem.
I use set parent on my character, so it will be a child of the ladder, and then I position the player at the center of the ladder. And it works very well on one ladder.
But when I duplicate the ladder, the Player will still be a child and position at the center of the first ladder, because I use the first ladder as the parent object. How can I solve this? Do you understand what I mean?
Check out our homepage. http://www.walsberg.no
Or my personal game blog for news about my games. http://retro-tetro.walsberg.no

phannDOTde

  • Full Member
  • ***
  • Posts: 237
    • Peter Hann .de
Re: Tile Movement
« Reply #7 on: August 01, 2014, 09:54:38 AM »
If you use "set parent" and leave the parent field empty it reparent the target Object to the world-root again (without resetting the orientation and position of course); so you should do that everytime you leave the ladder Logic to "unparent" your character. Hope that helps :-)

Rabagast

  • Hero Member
  • *****
  • Posts: 683
    • Homepage
Re: Tile Movement
« Reply #8 on: August 01, 2014, 02:21:35 PM »
Hi!

I know, but if I have 3 ladders. Ladder 1, ladder 2 and ladder 3.
Then the Player will be set to child of ladder 1, even if i'm climbing ladder 2 or 3.

Here is an example to show you what I have done so far. :)
I need to find a way to stop the y-movement at the top of the ladder and the bottom.
Maybe Jean Fabre can help a bit. Since he has a solution for everything. :)

Check out our homepage. http://www.walsberg.no
Or my personal game blog for news about my games. http://retro-tetro.walsberg.no

phannDOTde

  • Full Member
  • ***
  • Posts: 237
    • Peter Hann .de
Re: Tile Movement
« Reply #9 on: August 30, 2014, 03:37:23 AM »
Jean is pretty busy too ;-)

You could work with trigger boxes to figure out if the player character reached the end of a ladder. For the parenting you could set a tag to all ladder objects and use "find nearest" to figure out the ladder you want the character to be parented to.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Tile Movement
« Reply #10 on: September 18, 2014, 09:22:21 AM »
Hi,

 Yeah, we're all pretty busy I guess, and it's a good thing!

 Try the following, have a trigger that surround the start and one that surround the end of your ladder, and then make the logic to stop the character when it hits one of these colliders. I use this a lot, this is common practice for visual level design, it's easy to setup and tweak basically.

 Bye,

 Jean