Hello Guest

Author Topic: Having trouble getting sprite on same layer as tilemap  (Read 5512 times)

x0adam0x

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 13
    • View Profile
Having trouble getting sprite on same layer as tilemap
« on: January 31, 2014, 01:37:40 am »
I'm trying to set up a simple platformer.

Right now I've got moving left and right down, and am in the middle of trying to get jumping working but I had to add gravity.

So what I did was add a rigid body to the sprite, then I added a block collider to the sprite on the tilemap.

Does this have anything to do with the layering?

The sprite just keeps falling downwards and is not catching on the platform at all.

Sorry I'm a complete noob and used the search function as well as looked at some platformer demos and no luck.
I'm more of an artist ;)

x0adam0x

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 13
    • View Profile
Re: Having trouble getting sprite on same layer as tilemap
« Reply #1 on: January 31, 2014, 04:30:50 am »
I got it working, But now I've run into a different issue.

I've added a jump action with Play Maker.
With this I add force.

I can jump around just fine but if I double jump my sprite seems to change position a bit and fall through the tile.
Which is odd since I have the rigid body set to freeze Z completely.

What am I missing?

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Having trouble getting sprite on same layer as tilemap
« Reply #2 on: January 31, 2014, 11:25:38 am »
Have you tried 2D physics? Its much easier to use for these kinds of things - no need to worry about collider depths, etc.

x0adam0x

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 13
    • View Profile
Re: Having trouble getting sprite on same layer as tilemap
« Reply #3 on: January 31, 2014, 06:19:15 pm »
Oh really?
Do I just add a 2D box collidor on the ground and then 2d rigid body on character sprite?

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Having trouble getting sprite on same layer as tilemap
« Reply #4 on: January 31, 2014, 06:44:17 pm »
You will need to change the physics type in the sprite collection as well (don't forget to commit). That should generate 2D Colliders for the tile map instead of 3D. Then you can create 2D rigid body on the char sprite.

x0adam0x

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 13
    • View Profile
Re: Having trouble getting sprite on same layer as tilemap
« Reply #5 on: January 31, 2014, 07:07:33 pm »
So far so good, except I have my jump function as adding force through playmaker.
Now it's telling me I need a rigid body on the sprite in order to add force.

Any other alternative ways?

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Having trouble getting sprite on same layer as tilemap
« Reply #6 on: January 31, 2014, 09:57:27 pm »
You may have to find the equivalent 2D playmaker actions. I don't use it so I couldn't really give you any specifics - it might be better asking on the playmaker forums.

x0adam0x

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 13
    • View Profile
Re: Having trouble getting sprite on same layer as tilemap
« Reply #7 on: January 31, 2014, 11:44:34 pm »
Thanks for all the help!
Appreciate it!

I'll be back for sure.

I posted on the playmaker forums regarding this.