Friday, August 05, 2005

code for today. (or where Im up to with the code)

4 Comments:

Blogger Simon said...

you should split your code up into two/three classes - one for reading in the data and the other one for displaying it - i.e. each circle can be a node, which gets repeated over and over again. That way you can reuse it over and over again - without any problems...

The optional third class is for the line!

That just me though - keep up the good work

5:37 pm  
Blogger Alison said...

thank you for the suggestion!

I would do all these fabulous class things if I understood how to make them and use them in general. I have long had a feeling they would be the answer to my (what the hell array is this) problems.

I think I might well have a look, its getting to the stage where the draw loop is a little overpopulated!

10:30 pm  
Blogger Simon said...

it could look something like this (I haven't gone through all your code, so I don't know what its exactly doing - I got lost to be honest!)

void setup (){
size(1000,1000); //size of image to be created (nicely divisible by the map size of 20,000 by 20,000)
background(255,255,255);
}
void draw(){
Data data = new Data("C:/Games/UT2004/System/UT2004.log");
int n = data.getFile(); // get list of elements
// #
for(int i=0; i<n.length; i++){
Node node = new Node(n[0], n[1]);
node.run();
}
}

class Data {
String path;
String[] matchstart = { "ScriptLog: START MATCH" , "Log: appRequestExit(0)" , "Precaching:", "=" , "ScriptLog:" , "died" , "Log:"};
String[] logFile;

Data(String path){
this.path = path;
}

String[] getFile(){
return loadStrings(this.path);
}
}

class Node {

Node(float x, float y){
//
}

void run(){
// draw stuff here
}
}

2:14 am  
Blogger Alison said...

Ive almost got the code working, but had to re-write it. It definately makes more sense now.

I going to attempt classes soon, but I dont think Id have quite got them down by Saturday!

7:59 am  

Post a Comment

<< Home