Jump to content

Create a moving platform


sammae
 Share

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. ?

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...