Moving Platforms, and their collision

TangoDownStudiosTangoDownStudios Member Posts: 46
edited November -1 in Working with GS (Mac)
I want to make a platform that moves across the screen. Simple enough right? Well here are the stipulations:
1. Platform must move from left to right changing directions when boundaries are reached
2. Platform must retain its initial Y location and only move in the X
3. Platform must interact with objects that fall on top of it (in this example, falling balls)
4. Platform must not rotate

So I create an object whos Y location is constrained to its initialY value. Good sofar. Oh wait... not good! The collision with the balls is now all jacked up! When the balls hit the platform it tends to want to warp right through it, or exhibit some very weird collision detection : ( So I try to constrain the YVelocity of the platform to 0 and it is a liiiitle better, but not by much.

So I'm screwed already! So suddenly into my design phase for an actor who should be very simple to create...

Any advice from the talented among us?

Comments

  • JohnPapiomitisJohnPapiomitis Member Posts: 6,256
    first make the platform non movable, and select fixed rotation.

    In the platform actor put whatever collide rules you want in it

    then have a rule when self position x is less then or equal to 10( youll put the starting position ill use ten as a example)

    interpolate self position x to 400 (another example replace 400 with wheever you want it to stop)

    then have another rule when self position x is equal to or greater then 400(or whateevr you made the stop position)
    interpolate self position x to 10(or whatver you made the starting position)
  • DrGlickertDrGlickert Member Posts: 1,135
    For #2:

    Create a Real game.attribute called PlatformY.
    Then have a Constrain Attribute game.platformY to self.platformY, then a second Constrain Attribute self.platformY to game.platformY

    I'd use an interpolate with timers for #1

    Put a collision on the balls with the platform

    Turn rotation off for #4 (Also, turn Moveable off). Interpolate will stil move the platform.

    See where that gets you and let us know.
  • UtopianGamesUtopianGames Member Posts: 5,692
    The best way to do it if you want more control over the platform and to place it easy in the scene imo is to do...

    Make a real self.attribute call it startX

    change attribute self.startX to self.position.X (this stores the X position of the platform in the scene so you can now place it anywhere).

    make a rule if self.position.x = self.startX

    Interpolate self.position.X to self.startX+100

    otherwise (still using one rule)

    if self.position.x = self.startX+100

    Interpolate self.position.X to self.startX

    You can now place this actor anywhere and have multiple copies and also change the travel distance for each platform.

    Darren.
  • GLGAMESGLGAMES SingaporeMember Posts: 988
    wow very nice indeed, there's so many ways to do the same effect. This gives me the idea for my next platform jumping game.
Sign In or Register to comment.