View Single Post
  #7  
Old 08-09-2017, 04:18 AM
maximus_asinus maximus_asinus is offline
RIP DarkCloud_PK
Join Date: Oct 2001
Location: Canada
Posts: 3,745
maximus_asinus has a reputation beyond reputemaximus_asinus has a reputation beyond reputemaximus_asinus has a reputation beyond reputemaximus_asinus has a reputation beyond reputemaximus_asinus has a reputation beyond reputemaximus_asinus has a reputation beyond reputemaximus_asinus has a reputation beyond reputemaximus_asinus has a reputation beyond reputemaximus_asinus has a reputation beyond reputemaximus_asinus has a reputation beyond repute
I created the desired fill effect, but I hit another snag. I want to break the loop when 'this.current' is equal to 'this.final', but with how the math is done 'this.current' is always going to be off by a few fractions of a decimal. How can I get around this without messing with how fluid the animation is?
PHP Code:
// Created by maximus_asinus

//#CLIENTSIDE
function onPlayerChats() {
  if (
player.chat == "debug") {
    
this.final = {9,39,47,39,47,27,55,27,55,47,9,47};
    
this.current = {11,41,49,41,49,29,53,29,53,45,11,45};
    
player.chat " ";
    
showpoly(200,this.current);
    
changeimgcolors 200,0,0,1,0.75;
    
setTimer(0.05);
  }
}
function 
onTimeout() {
  for (
i=0;i<13;i++;) {
    
temp.distx this.final[0+i] - this.current[0+i];
    
temp.disty this.final[1+i] - this.current[1+i];
    
temp.movelength = (temp.distx temp.distx temp.disty temp.disty) ^ 0.5;
    
temp.distx temp.distx temp.movelength;
    
temp.disty temp.disty temp.movelength;
    
this.current[0+i] = this.current[0+i] + temp.distx 0.05;
    
this.current[1+i] = this.current[1+i] + temp.disty 0.05;
    
showpoly(200,this.current);
    
i++;
    
setTimer(0.05);
  }

__________________
Save Classic!
Reply With Quote