Line Graph Sine Movement

For questions about using Classic.

Post » Mon Apr 16, 2012 4:55 am

Hey guys, I'm stumped yet again and was hoping I could get some advice.

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: http://www.youtube.com/watch?v=8ezAX7E4prc

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.

So can anyone help?
B
16
S
2
G
1
Posts: 156
Reputation: 2,112

Post » Mon Apr 16, 2012 12:33 pm

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.
ImageImage
B
25
S
6
G
8
Posts: 773
Reputation: 6,643

Post » Mon Apr 16, 2012 11:08 pm

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!
B
16
S
2
G
1
Posts: 156
Reputation: 2,112

Post » Thu Apr 19, 2012 8:35 am

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.Jim152012-04-19 08:36:48
B
16
S
2
G
1
Posts: 156
Reputation: 2,112

Post » Thu Apr 19, 2012 10:45 am

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.
B
10
S
6
G
3
Posts: 127
Reputation: 2,481

Post » Sat Apr 21, 2012 11:23 pm

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.
B
16
S
2
G
1
Posts: 156
Reputation: 2,112

Post » Sun Apr 22, 2012 5:17 am

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.
B
10
S
6
G
3
Posts: 127
Reputation: 2,481

Post » Sun Apr 22, 2012 6:01 am

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...
B
16
S
2
G
1
Posts: 156
Reputation: 2,112


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 8 guests