sammae

Create a moving platform

Recommended Posts

Hi, 

I've been stumped by this for quite awhile and I feel as if it's so simple. I'm simply trying to create a platform that moves back and forth that a player can jump on. 

I got a platform to move by doing something like this:
 

platform = this.physics.add.sprite(300, 100, 'form');
platform.body.allowGravity = false;
platform.body.immovable = true;
platform.body.velocity.x = 100;

 

But it just keeps moving in one direction and I can't figure out how to make it collide with the player. I tried the:

this.physics.add.collider(this.player, platform);

But that did not work.

 

I just want a simple platform that moves back and forth that the player can jump on. Please any help is greatly appreciated, I'm ready to pull my hair out over this. 😞

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.