Laugh Test

Ruby The Roobster michaeleverestc79 at gmail.com
Thu Sep 24 19:15:00 UTC 2020


So I'm making some sort of library(it's not online yet).
In that Library there is a class called dextend.gameengine.shape. 
  In this class, I've made part of an update function(that the 
user of the library calls to update the status of the flag). Now, 
this update function has to check a lot of things(flags, certain 
variables, checks that are in these checks,etc.)  Here is the 
function so far(It probably has errors and bugs but I'll fix 
those when I actually finish the function):

void Update(shape* check_if_hit = null)
{
if(flags & Flags.Gravity)
{
if(check_if_hit is null)
     throw new Exception("If Flags.Gravity is true, then 
check_if_hit must point to a shape.");
if(this.move_speed) {
double[3] sorted_point = 
sortLowtoHigh!double([next_move.x,next_move.y,next_move.z]);
for(int i = 0;i < this.points.length;i++) {
     if(sorted_point[2] == this.next_move.x)
     {
         this.points[i].x += this.move_speed;
         this.next_move.x -= this.move_speed;
         this.points[i].y += this.move_speed(this.next_move.y / 
this.next_move.x);
         this.next_move.y -= this.move_speed(this.next_move.y / 
this.next_move.x);
         this.points[i].z += this.move_speed(this.next_move.z / 
this.next_move.x);
         this.next_move.z -= this.move_speed(this.next_move.z / 
this.next_move.x);
     }
     else if(sorted_point[2] == this.next_move.y)
     {
         this.points[i].x += this.move_speed(this.next_move.x / 
this.next_move.y);
         this.next_move.x -= this.move_speed(this.next_move.x / 
this.next_move.y);
         this.points[i].y += this.move_speed;
         this.next_move.y -= this.move_speed;
         this.points[i].z += this.move_speed(this.next_move.z / 
this.next_move.y);
         this.next_move.z -= this.move_speed(this.next_move.z / 
this.next_move.y);
     }
     else if(sorted_point[2] == this.next_move.z)
     {
         this.points[i].x += this.move_speed(this.next_move.x / 
this.next_move.z);
         this.next_move.x -= this.move_speed(this.next_move.x / 
this.next_move.z);
         this.points[i].y += this.move_speed(this.next_move.y / 
this.next_move.z);
         this.next_move.y -= this.move_speed(this.next_move.y / 
this.next_move.z);
         this.points[i].z += this.move_speed;
         this.next_move.z -= this.move_speed;
     }
}
if(this.next_move.x <= 0 || this.next_move.y <= 0 || 
this.next_move.z <= 0) {
     for(int i = 0;i < this.points.length;i++)
     {
         this.points[i].x += this.next_move.x;
         this.points[i].y += this.next_move.y;
         this.points[i].z += this.next_move.z;
     }
this.move_speed = 0;
}
}
}
}

There. Does that look confusing or what?


More information about the Digitalmars-d mailing list