0 Members and 1 Guest are viewing this topic.

How to run it btw? I get "A java exception error has occured"

What if you want to set one of the vars a negative value

-Acceleration is a work in progress (if someone could supply me with getting the physics nailed down, that's be amazing)

Y_Pos = 0Accel_Value = 0bool Bird_Is_Flying = falseRepeat (collision(bird,pipe)) or (quit_game = true) or (Y_Pos < 0) or (Y_Pos > (max_y_pos))//Replace (max_y_pos) with an actual maximum y position, i.e. the minimum y-value needed in order for the bird not to be visible If Bird_Is_Flying = true Y_Pos = Y_Pos - Accel_Value Accel_Value = Accel_Value - (constant1) //Replace (constant) with any constant, tweak to taste (and it must be bigger than (constant2) shown later) If Accel_Value <= 0 //Less than or equal to 0 Accel_Value = 0 Bird_Is_Flying = false EndIf Else Y_Pos = Y_Pos + Accel_Value Accel_Value = Accel_Value + (constant2) //Replace (constant) with any constant, tweak to taste (and it must be smaller than (constant1) shown earlier) EndIf If (flap_button_pressed = true) and (flap_button_held = false) //Debounce it, or else you would fly higher than expected Bird_Is_Flying = true Accel_Value = (constant3) //(constant3) must be WAY bigger than the other two constants; the bigger it is, the higher the jump EndIf//drawing, scrolling, and other stuff hereEndRepeat//dying code goes here

Lol, now someone should do this for calcs.

private static void quadEqu(){ results = new String[2]; if(b*b - 4 * a * c >= 0){ results[0] = "" + (float)(-b + Math.sqrt(b*b - 4 * a * c))/(2*a); results[1] = "" + (float)(-b - Math.sqrt(b*b - 4 * a * c))/(2*a); }else{ negRoot = true; results[0] = "" + (float)-b/(2*a) + " + " + (float)Math.sqrt(Math.abs(b*b - 4 * a * c))/(2*a) + "i"; results[1] = "" + (float)-b/(2*a) + " - " + (float)Math.sqrt(Math.abs(b*b - 4 * a * c))/(2*a) + "i"; }}

I'll take a look and refactor my code later on. Thanks ^_^

Why do you need a quadratic solver? The equation is simple enough.