Thread: Heart Moniter
View Single Post
  #5  
Old 01-22-2008, 05:48 PM
Chompy Chompy is offline
¯\(º_o)/¯
Chompy's Avatar
Join Date: Sep 2006
Location: Norway
Posts: 2,815
Chompy is just really niceChompy is just really niceChompy is just really nice
Send a message via MSN to Chompy
basicly you could do something like:

PHP Code:
function onCreated() {
  
this.dsize 10;
  
this.data 0;
  
this.mode 1;
}
public function 
onAddData(temp.data) {
  if (
this.mode == 1) {
    
this.data.insert(0temp.data);
    if (
this.data.size() == this.dsize+1){
      
this.data.delete(this.dsize-1);
    }
  }else if (
this.mode == 2) {
    
this.data.add(temp.data);
    if (
this.data.size() == this.dsize+1) {
      
this.data.delete(0);
    }
  }
}
public function 
onGetData()
  return 
this.data;
public function 
onGetDataAtIndex(index)
  return 
this.data[index]; 
So, use onAddData() to feed the array, depending on the mode the way it's read (mode 1 = read from left to right (index 0 and up), mode 2 = read right to left (last index to index 0))

Could be made easier tho, but, an EKG with player's health.. Doesn't sound.. 'logical' with graal as combo
__________________
Reply With Quote