View Single Post
  #4  
Old 12-30-2009, 06:40 AM
fowlplay4 fowlplay4 is offline
team canada
fowlplay4's Avatar
Join Date: Jul 2004
Location: Canada
Posts: 5,200
fowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond repute
Here's a nifty little block sine wave.

PHP Code:
//#CLIENTSIDE
function onCreated() {
  
setTimer(0.05);
}

function 
onTimeout() {
  
drawSine(timevar2);
  
setTimer(0.05);
}

function 
drawSine(initial) {
  
temp.inc pi 6;
  
temp.radius 64;
  for (
temp.initialtemp.< (initial+(pi*2)+temp.inc); temp.+= temp.inc) {
    
temp.tx 100 24 temp.j;
    
temp.ty = (screenheight 2) + temp.radius sin(temp.i);
    
temp.img showimg(200 temp.j"block.png"temp.txtemp.ty);
    
temp.img.layer 4;
    
temp.j++; 
  }

It's important because you can throw any number at it, and it'll return between -1 and 1. I only really know how it works through playing with it, so I would probably explain it wrong but we'll just have to wait for Tig and his Uni Math knowledge skills.
__________________
Quote:
Reply With Quote