Jump to content

  • Log In with Google      Sign In   
  • Create Account

We need your feedback on a survey! Each completed response supports our community and gives you a chance to win a $25 Amazon gift card!


Game like "Tiny Wings" or "Dragon,fly!"


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
2 replies to this topic

#1 edgarllorente   Members   -  Reputation: 103

Like
0Likes
Like

Posted 14 July 2012 - 05:11 AM

Hello
I'm trying to make a terrain like the one on those games, I mean a terrain that is a wave that keeps changing and where the object keeps oscilating.

I've never done anything like this before and for now I got a reasonable success... I managed to draw a wave like that by varying the amplitude of the wave every point... more o less this is the resoult:

Posted Image

To make the object follow the wave is easy, its just getting the amplitude of the y of the function that draws my wave and drawing it there...
My problem comes when I try to apply physics, although I thought I managed to do it I realized I don't... when the physics are calculated within miliseconds the object moves little by little, but when applied for a second or so it moves more than 1000px

So... I wondered if someone can help me appliying the physics to this wave...

Edgar

Sponsor:

#2 6677   Members   -  Reputation: 1058

Like
0Likes
Like

Posted 14 July 2012 - 07:58 AM

are you generating your line in your main game loop?
Might be that your accidently regenerating a line each time

#3 edgarllorente   Members   -  Reputation: 103

Like
0Likes
Like

Posted 15 July 2012 - 06:00 PM

I have been doing some math about it, and what I need to solve is how to get a formula that gives me how much pixels the object has to advance in a certain time, something like "x = x0 +vt + 0.5*t*t" but for the wave.
The wave is generated by a formula that looks like this: "f(x) = A(x)*sin(x * (360/waveLongitude) )" where A(x) is the amplitude in that point generated by a formula.

The problem is how to get a new formula that return the x giving to it the time




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS