Need a function that...
Started by
Mero
, Aug 02 2011 04:22 PM
7 replies to this topic
#1
Posted 02 August 2011 - 04:22 PM
Slides a npc from it's position to a coordinate of a circle center in the middle of the screen given an angle and radius.
#2
Posted 02 August 2011 - 04:42 PM
Could you use the Circular Movement submission in the database? Maybe you could edit that to do what you need to.
#3
Posted 02 August 2011 - 04:48 PM
Could you use the Circular Movement submission in the database? Maybe you could edit that to do what you need to.
I need it to slide to position not instantly move to the position. So no that won't work.
EDIT: May'be I should try storing the position and then slide it there myself.
Edited by blackbishop89, 02 August 2011 - 04:49 PM.
#4
Posted 02 August 2011 - 05:10 PM
You could place a dummy ffc at a certain position on that circle, have your main FFC slide to that, and then do what you need to.
#5
Posted 02 August 2011 - 05:13 PM
I need it to slide to position not instantly move to the position.
What you want is an interpolation function. For example:
CODE
Pos start;
Pos end;
int frame;
float t = 0; //where t = (current_update_frame / total_frames);
bool update() {
npc->X = Lerp(start.x, end.x, t);
npc->Y = Lerp(start.y, end.y, t);
frame++;
t = frame / 60; //1 second
return t >= 1;
}
#6
Posted 02 August 2011 - 05:16 PM
What you want is an interpolation function. For example:
CODE
Pos start;
Pos end;
int frame;
float t = 0; //where t = (current_update_frame / total_frames);
bool update() {
npc->X = Lerp(start.x, end.x, t);
npc->Y = Lerp(start.y, end.y, t);
frame++;
t = frame / 60; //1 second
return t >= 1;
}
Won't work for what I want to do. I have 6 npcs and I need to move them all at the same step speed in a angular direction.
#7
Posted 02 August 2011 - 05:24 PM
Eh? npcs' don't have angles though. You have to manually set their positions to get them to do anything you want really.
#8
Posted 02 August 2011 - 05:27 PM
Eh? npcs' don't have angles though. You have to manually set their positions to get them to do anything you want really.
Not directly though but with the registers and vectorX/Y functions you can give it to them. They can have angular movement. Just a little more lines of code is required.
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users