Author Topic: Moving Platforms  (Read 2601 times)

0 Members and 1 Guest are viewing this topic.

Offline leafy

  • CoT Emeritus
  • LV10 31337 u53r (Next: 2000)
  • *
  • Posts: 1554
  • Rating: +475/-97
  • Seizon senryakuuuu!
    • View Profile
    • keff.me
Moving Platforms
« on: March 24, 2011, 10:50:53 pm »
What I have problems with is not creating the platform but getting the player to detect the platform and move with it. Pixel-detection can detect, but not cause the player to move with the platform.
The best way I can come up with is to use a combination of pixel testing and looping through all the objects to move the player, but is there a better way?
In-progress: Graviter (...)

Offline phenomist

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 132
  • Rating: +46/-3
    • View Profile
Re: Moving Platforms
« Reply #1 on: March 24, 2011, 10:52:10 pm »
Uh, instead of looping through all the objects, maybe check all of the objects touching the player instead?
Level Designer for Graviter

[Disclaimer: I can't program for my life.]

Offline leafy

  • CoT Emeritus
  • LV10 31337 u53r (Next: 2000)
  • *
  • Posts: 1554
  • Rating: +475/-97
  • Seizon senryakuuuu!
    • View Profile
    • keff.me
Re: Moving Platforms
« Reply #2 on: March 24, 2011, 10:52:30 pm »
You have to loop through all the objects to see which ones are touching the player :P
In-progress: Graviter (...)

Offline phenomist

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 132
  • Rating: +46/-3
    • View Profile
Re: Moving Platforms
« Reply #3 on: March 24, 2011, 10:53:49 pm »
Wouldn't you have to loop through all the objects to perform movement operations on the moving platforms anyways? Maybe implement a player check within this.
Level Designer for Graviter

[Disclaimer: I can't program for my life.]

Offline Deep Toaster

  • So much to do, so much time, so little motivation
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 8217
  • Rating: +758/-15
    • View Profile
    • ClrHome
Re: Moving Platforms
« Reply #4 on: March 25, 2011, 10:58:30 am »
That still doesn't move the player along with it, though...

Maybe store the movement of the object in a temporary variable, then just before moving the object check if the object's close enough to the player, and if so add its movement to that of the player as well?
« Last Edit: March 25, 2011, 10:58:43 am by Deep Thought »