Collision with rotating objects

This forum is currently in read-only mode.
From the Asset Store
Hand-painted tiles, objects, animated objects, and background to build a colorful Mayan civilization environment.
  • First of all: "Hello everybody, I just registered to this forum"

    Recently I discovered Construct and I am really satisfied with what I get and what I can do with it. Its a great program and its lots fun to play with.

    The last two days I spent my time creating a small sidescroller to learn handling the program. Yesterday night (until 3am in the morning -_-)I tried to solve a problem concenrning the player colliding with a rotating object. I will try explaning it further:

    Think of a seesaw (a solid box with a sine behavior) and the player stepping on this seesaw. Now, when the seesaw moves the player slides along with it and somehow construct thinks that the player is falling and plays the falling-animation for just about a millisecond. That causes that the player jiggles alot, which of course looks very strange.

    I tried changing the collsion mode from point to bounding box to per pixel and I added another condition to "If Player is falling" + "If no key is pressed" and several things with "overlapping" and "collison" with the rotating object. But nothing worked so far.

    So, my question is:

    How can I make the player doesn't jiggle on a rotating object? Is there any hint I haven't discovered yet? Hope you guys can help me out.

    Thanks in advance!

  • you have to manually move his position, or put a buffer of 2 frames or wtv for the falling animation to activate.

  • you could also check for "player is overlapping object at offset"

    something like:

    +compare player is overlapping platform at Y-3 or greater
    -animation set to "standing"
    [/code:3k9ig7ty]
    
    ~Sol
  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Thanks for your answers.

    QuaziGNRLnose:

    How can I move the player in a non absolute way? Like this: "current position in Y" +1. It seems that I can only type in an absolute number in the "Set Y"-field. And how do I create a buffer for the animation to trigger? Should the animation consist of 3 frames (1+2: Standing, 3:falling)? Then I would need another falling animation for when the player really falls.

    SoldjahBoy:

    I already tried that and the problem is that if I then want to move the player the walking animation doesn't play because its overwritten by the falling-animation. Therefore I added another condition (If no key is pressed)....but somehow that doesn't work either :/

    Here's a little screenshot to clarify the problem:

    (Think of the house swinnging from left to right)

    There must be a way...

  • Thanks for your answers.

    QuaziGNRLnose:

    How can I move the player in a non absolute way? Like this: "current position in Y" +1. It seems that I can only type in an absolute number in the "Set Y"

    You mean "Set Y to Player.Y + 1?" You write that pretty much in the manner you described. Check out the wiki on expressions. You can get an expression for an object by typing "objectName." in the expression editor. After you type the "." a dropdown list will pop up and show you all the expressions that you can retrieve for the object. Alternately, you can double-click an object in the lower pane of the editor and pick one of the Get's. Like, for instance, "Get Y."

    As for your other issue:

    First, "On any key pressed" is a trigger, you can't really negate it. "On key pressed" triggers ONE time in the first tick that you press a key. "Key is down" triggers every tick that the key is down.

    Second, you're detecting the object below the player's feet with the offset, yes? Then you only need to set the offset in the Y axis. So your condition would read "Player overlaps house at Offset (0,3)"

    You might want to rework your events so they read like so:

    + Player: Is falling
    + NOT Player: Is overlapping Solid at offset (0,3)
      -> Sprite: Set animation to Falling
    
    + Player: Is Jumping
    + NOT Player: Is overlapping Solid at offset (0,3)
      -> Sprite: Set animation to Jumping
    
    + Player: Is overlapping Solid at offset (0,3)
       + Player: Is walking
          -> Set animation to "Running"
       + Else
          -> Set animation to "Standing"
    
    [/code:kkw8qxi6]
    
    Also, this probably isn't going to be the end of the issue.  I can tell you now that getting a platform object and it's sprite to look 100% good on a teeter-totter is probably going to be a chore.  It's going to likely require a lot of custom events with advanced math to place the objects and set their angle in relation to the platform.  Special circumstances require special solutions, and what you're doing is a bit beyond the scope of the platform behavior.
  • wow deadeye, thanks for your help and explanations. That "Set Y to Player.Y + 1" really did the trick. The player still jiggles a bit (no chance of getting rif of this?) but the "falling" animation doesn't activate if the player is not falling. Looks much more normal now. A big step forward!

    I've still got another question Is it possible to "pin" the player to the swinging house. Right now, when the house swings to left, the player holds his position so that it looks like he's sliding on that house. I guess that might be a bit trickey, right?

    I know these are not typical platform features but I want try a few things before I might begin creating a full game. I want to test the limits so I can plan what I can do and what I can't do.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)