Dynamic movement code
Well I don't know if that's what it should be called. Anyways what I mean is that if there would be like one pixel in coordinates 10, 10 and you would randomly generate new coordinates for it. Like 205, 163. Now, how can you make that pixel move there so that it doesn't jump there immediately but kind of slides there. I tried to make this work in JavaScript but it went a bit too messy and it didn't even work. I know this must be some basic stuff because it is used quite a lot in all kind of programming. And I think you just have to first count how many pixels in x and how many in y the pixel has to move to be on the right track. But I just couldn't get it working and I was probably making it too complicated.
So could someone give me some advice on this or give something to google for? I'd really like to learn more about this.
http://en.wikipedia.org/wiki/Linear_equation
You have two points, find the slope and create a point slope linear equation. Find an appropriate time limit for each distinct point and go through all x values starting at your first point while making sure when you graph your new point you clear the previous one before you blit it.
EDIT:
I think a general term is just animation or to animate.. when I read 'Dynamic movement code' I thought self modifying code.
I think a general term is just animation or to animate.. when I read 'Dynamic movement code' I thought self modifying code.
Well I'm finnish so I'm not so good with the english terms :P
I was trying to do it with math but it went too complicated and didn't work so I just gave up :/
Thanks for the help anyways (even though I didn't understand much).
EDIT: Ok now I got what that wikipedia page was about. I've had that stuff in school and I knew that if you want to do it with math it has to be something like that. I just can't apply it to my problem.
It's rather difficult to get what you mean because we have different terms in math.
Would be cool to solve this one but I think I won't get it.