0 Members and 1 Guest are viewing this topic.
varbullet : array[0..10] of array[0..10] of single;procedure ActivateServer();beginbullet[1][1] := 0; //constant xstart , where the flames are emitted at the beginning bullet[1][2] := 0; //constant ystart ,where the flames are emitted at the beginning bullet[1][3] := 0; //bullet_x , where the flames are emitted during moving bullet[1][4] := 0; //bullet_y , where the flames are emitted during moving //bullet[1][1+3] and bullet[1][2+4] has to be the same (x and y koordinates) , otherwise it won't workbullet[1][5] := 1; //positiv/negativ multiplicator , default = 1 (the direction , the bullets move)bullet[1][6] := -1; //bullets moving , horizontal = 1 , vertikal = -1bullet[1][7] := 10; //constant counter bullet[1][8] := 10; //counter , after reaching "0" a random direction will be choosen for the bulletsbullet[1][9] := 0; //constant seconds (default: 0)bullet[1][10] := 0; //seconds , after reaching "0" the bullets-moving goes on//bullet[1][9] and bullet[1][10] have to be the same , otherwise it won't work//Please do not change any value during a procedure is running , it will not work!end;procedure MovingBullets(velo_speed : single; bulletindex, radius , bullets , bullet_interspace, min_steps , max_steps , random_switch : integer; bullettype : byte);vari, w, rand1,rand2 : integer;beginrand1 := 0;rand2 := 0;w := 0;if bullet[bulletindex][10] = 0 thenbeginfor i := 0 to bullets do      begin      if bullet[bulletindex][6] < 0 then      CreateBullet(bullet[bulletindex][3], bullet[bulletindex][4]+w,0, bullet[bulletindex][5]* velo_speed,100,bullettype,0)      else if bullet[bulletindex][6] > 0 then      CreateBullet(bullet[bulletindex][3]+w, bullet[bulletindex][4], bullet[bulletindex][5]* velo_speed, 0,100,bullettype,0);  w := w + bullet_interspace;      if bullet[bulletindex][6] < 0 then      CreateBullet(bullet[bulletindex][3], bullet[bulletindex][4]-w, 0, bullet[bulletindex][5]* velo_speed,100,bullettype,0)      else if bullet[bulletindex][6] > 0 then      CreateBullet(bullet[bulletindex][3]-w, bullet[bulletindex][4], bullet[bulletindex][5]* velo_speed, 0,100,bullettype,0);  end;if random_switch = 1 thenbegin if bullet[bulletindex][8] = 0 then      begin      while (rand1 = 0) do rand1 := random(0,3)-1;      bullet[bulletindex][6] := bullet[bulletindex][6] * (-1);      bullet[bulletindex][5] := bullet[bulletindex][5] * (-1);      bullet[bulletindex][8] := random(min_steps,max_steps);      end; bullet[bulletindex][8] := bullet[bulletindex][8] - 1;end;if (Distance(bullet[bulletindex][3],bullet[bulletindex][4],bullet[bulletindex][1],bullet[bulletindex][2]) >= radius) then bullet[bulletindex][5] := bullet[bulletindex][5] * (-1);if bullet[bulletindex][6] > 0 then bullet[bulletindex][3] := bullet[bulletindex][3]+ ((velo_speed*20) * bullet[bulletindex][5]);if bullet[bulletindex][6] < 0 then bullet[bulletindex][4] := bullet[bulletindex][4]+ ((velo_speed*20) * bullet[bulletindex][5]);bullet[bulletindex][10] := bullet[bulletindex][9];end;if (bullet[bulletindex][10] <> 0) then bullet[bulletindex][10] := bullet[bulletindex][10] - 1;end;procedure AppOnIdle(Ticks: integer);begin//example: MovingBullets(1, 1, 150, 2, 20, 3, 20, 1, 5);end;