Jump to content

Photo

Need a function that...


  • Please log in to reply
7 replies to this topic

#1 Mero

Mero

    Touch Fluffy Tail

  • Banned
  • Real Name:Tamamo No Mae
  • Location:Rainbow Factory

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 Master Maniac

Master Maniac

    Earth, Wind, Fire, and Water.

  • Members
  • Real Name:kris

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 Mero

Mero

    Touch Fluffy Tail

  • Banned
  • Real Name:Tamamo No Mae
  • Location:Rainbow Factory

Posted 02 August 2011 - 04:48 PM

QUOTE(Master Maniac @ Aug 2 2011, 03:42 PM) View Post

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 Master Maniac

Master Maniac

    Earth, Wind, Fire, and Water.

  • Members
  • Real Name:kris

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 Gleeok

Gleeok

    It's dangerous to dough alone, bake this.

  • Members
  • Real Name:Pillsbury
  • Location:Magical Land of Dough

Posted 02 August 2011 - 05:13 PM

QUOTE(blackbishop89 @ Aug 2 2011, 02:48 PM) View Post

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 Mero

Mero

    Touch Fluffy Tail

  • Banned
  • Real Name:Tamamo No Mae
  • Location:Rainbow Factory

Posted 02 August 2011 - 05:16 PM

QUOTE(Gleeok @ Aug 2 2011, 04:13 PM) View Post

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 Gleeok

Gleeok

    It's dangerous to dough alone, bake this.

  • Members
  • Real Name:Pillsbury
  • Location:Magical Land of Dough

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 Mero

Mero

    Touch Fluffy Tail

  • Banned
  • Real Name:Tamamo No Mae
  • Location:Rainbow Factory

Posted 02 August 2011 - 05:27 PM

QUOTE(Gleeok @ Aug 2 2011, 04:24 PM) View Post

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. icon_wink.gif


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users