playMaker

Author Topic: Having trouble with 2D Movement script  (Read 10024 times)

Copywright

  • Playmaker Newbie
  • *
  • Posts: 6
Having trouble with 2D Movement script
« on: November 19, 2012, 11:34:25 PM »
Hey,

I'm a new Unity user, and I'm using Playmaker and mainly 2DTK to develop a game. I'm trying to write a walking script, and though I could script it normally without too much trouble, I'd much rather get used to Playmaker. So, can anyone help me out? I constrained all the rigibodies to the X-Y axis, and made then kinematic. MY questions are:

Which actions should I be using to get movement working? I know it's in Input, but I'm having trouble trying to get the tutorial about the third person controller into 2D.

The ground and platforms, etc., should also all be rigibodies, right? And, is there anyway to specify specific box colliders made in 2D toolkit? (i.e for beat em up, the face collider, feet collider, etc., can I specify them to script what happens when they are collided with?)

Copywright

  • Playmaker Newbie
  • *
  • Posts: 6
Re: Having trouble with 2D Movement script
« Reply #1 on: November 25, 2012, 08:04:21 PM »
Bump,

I really need a point in the right direction, please.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Having trouble with 2D Movement script
« Reply #2 on: November 26, 2012, 12:21:51 AM »
Hi,

 Sorry, missed your post somehow...

You need to look into Character Controllers. This is a Unity convenient special physics component:
http://docs.unity3d.com/Documentation/Components/class-CharacterController.html

With this, you'll have a good base. With PlayMaker, you can control this controller using the following actions:
The best way to start would be to study the Sample provided by PlayMaker and load "TestLab/Character/ControllerSimpleMoveAndJump"

Using this into a 2d constraint world is simply a matter of set up, for example, only move your character controller on 2 axis to begin with.

I also made some variants of this scene for mobile etc, so if you want to go mobile, let me know.

 -- Yes, ground and platforms should be rigid bodies with colliders
 -- 2d toolKit can specify colliders for your sprites yes, it's in the 2d toolkit doc
http://www.2dtoolkit.com/doc/tutorial/creating_polygon_colliders.html

also, regards your face and feet collide, you seem to be after something quite specific, can you describe a bit more what you are after?

bye,

 Jean

Copywright

  • Playmaker Newbie
  • *
  • Posts: 6
Re: Having trouble with 2D Movement script
« Reply #3 on: November 29, 2012, 06:17:11 PM »
I mean, is it possible to specify the colliders made by 2DTK in Playmaker.

Ex. Making a side scrolling beat em up. I have different colliders set on different parts of the sprite (the face, the legs). 2DTK called this "islands" (basically different colliders set on different parts of a sprite). Is there any way to specify the face collider for when hit in the face, and the collider on the legs for when hit in legs?

colpolstudios

  • Sr. Member
  • ****
  • Posts: 370
Re: Having trouble with 2D Movement script
« Reply #4 on: November 30, 2012, 12:05:20 PM »
sorry to jump in here but where do I find this.

The best way to start would be to study the Sample provided by PlayMaker and load "TestLab/Character/ControllerSimpleMoveAndJump"

I do not have the 2d toolKit, but possibly you could add a tag to each collider to help identify them ??

You could then hopefully use on trigger enter and a switch to cycle through the possiblities maybe (unsure) i am new.

sorry I can not be of more help :(

Copywright

  • Playmaker Newbie
  • *
  • Posts: 6
Re: Having trouble with 2D Movement script
« Reply #5 on: December 01, 2012, 01:54:24 PM »
I've studied the sample, but I keep running into a problem. I did everything in the sample, but tweaked it for 2D (restaining Z axis motion, and set Map to Plane to XY). However, it doesn't work, I see the  vector3 "move" values changing, not the transform of the sprite. Any idea why?

colpolstudios

  • Sr. Member
  • ****
  • Posts: 370
Re: Having trouble with 2D Movement script
« Reply #6 on: December 01, 2012, 02:37:07 PM »
Were do I find the example "TestLab/Character/ControllerSimpleMoveAndJump"?

I am looking at a future purchase of the 2dtoolkit and would be intrested in your testing.

Watching this topic in the hope you get it working.



Copywright

  • Playmaker Newbie
  • *
  • Posts: 6
Re: Having trouble with 2D Movement script
« Reply #7 on: December 01, 2012, 05:20:06 PM »
This is where you find the sample:

http://www.hutonggames.com/samples.php

Start a new project for that unitypackage. The controller works well, but for some reason it's not working well for 2D. Now, I'm just looking for example 2D playMaker games, and see how they handle it.

colpolstudios

  • Sr. Member
  • ****
  • Posts: 370
Re: Having trouble with 2D Movement script
« Reply #8 on: December 04, 2012, 04:02:22 PM »
Many thanks for the link.

a little busy with an old project, but plan on downloading these and getting to know playmaker better.

solved for me at this point.