Thread: angles
View Single Post
  #6  
Old 02-03-2002, 08:52 AM
TDO2000 TDO2000 is offline
Registered User
TDO2000's Avatar
Join Date: Jul 2001
Location: Germany
Posts: 655
TDO2000 is on a distinguished road
hmmm I don't really know a formular for this but a way to emulate something like this is able with using vars for vertical and horizontal movement...

something like this for example:

NPC Code:

if(playerenters){
this.vx=1;
this.vy=-1;
timeout=.05;
}

if(timeout){
if(!onwall(x+(width/2)+this.vx+(.025*this.vx),y+height/2)){x+=this.vx;}
else {this.vx=this.vx*(-1);}

if(!onwall(x+(width/2),y+(height/2)+this.vy+(.025*this.vy))){y+=this.vy;}
else {this.vy=this.vy*(-1);}

timeout=.05;
}



it's like the pong ball
__________________
No Webhost at the moment
Reply With Quote