Line Graph Sine Movement

This forum is currently in read-only mode.
From the Asset Store
solution for games like "fruit ninja" and drawing applications
  • Hey guys, I'm stumped yet again and was hoping I could get some advice. <img src="smileys/smiley1.gif" border="0" align="middle" />

    I'd like to make a moving line graph that the player has to ride over a pitfall in my platformer. It's a similar idea to the moving platforms of Super Mario World, except here it's a bit more complicated because a line graph moves at different angles when moving up and down.

    Here's an example of what I mean: youtube.com/watch

    Except like I said, it would move at an angle... but truth be told, I can't seem to figure out how Sine works at all. As in, I can't even get the platform to move. <img src="smileys/smiley36.gif" border="0" align="middle" />

    So can anyone help?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • download

    There's a problem, I don't know how to get rid of bouncing of the player sprite. Maybe someone else could help with that.

    I think they'd need to know how do you want the sprite behave when it's on the platform? Do you want it to keep it's angle (as it's now in the example) or rotate with the platform? I've tried to rotate it, it's bounced bit less, but still it wasn't good enough.

  • Interesting, I wouldn't have thought of RTS movement... guess I just kind of assumed sine was the only way. The bouncing was pretty minor to me, and I think it may have to do with the fact that it's many different boxes moving. In my case, it's just going to be one solid line (Hopefully that works anyway.), but the movement you used was perfect for what I have in mind.

    Thanks Noga!

  • Hey Noga, if you happen to see this thread again, I have a question...

    In the sub-event where you looped waypoints 1-8, your action was:

    System: Create Object MovingPlatform on layer 1 at (20 + 32 * LoopIndex, 300)

    I guess my question would be what "(20 + 32 * LoopIndex, 300)" means? Whenever I use this, the platform I'm using doesn't flow nearly as smoothly as yours, and in addition, I can't seem to create additional platforms like your cap demonstrated. I have to add my own in on the layout, and I think that's why when I do it for my game, it doesn't look as nice or function as well as yours.

  • 20 ~ this is the default x coordinate.

    32*loopindex ~ when you create the first platform, it will be 0, the second will be 32 and so on. I guess he used 32 because the object is 32 pixel wide, you can increase\decrease this number to set an offset.

    The 300 is the y coordinate.

    So when you check the loopindex, you get a number which tells you how many times the loop was done.

  • Thanks Pecek, that cleared things up for me. I just have what should be one more question...

    How would I go about making the angle of the player equal to the angle of the moving platforms I'm using? Noga mentioned that it made things look more smooth, and I'd just like to see how it looks, because at the moment my player sprite is just hanging off of the platform when it moves at an angle.

    Thanks again for the help guys.

  • The most simple way to achieve this is something like

    + Player: Player overlaps MovingPlatform

    + MovingPlatform: Pick closest to: Player.X, Player.Y

    -> Player: Set angle to MovingPlatform.Angle

    But this only looks good if the player can't go to the opposite direction.

  • Indeed. I recently did something similar to what you suggested and have encountered that very problem, since it just looks like my character is running backwards (Which is a bit confusing to me). I don't consider it a huge deal since it still looks pretty nice, but if you're curious how to fix that up I'll let you know if I find a way to make it work...

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