First of all I want to apologize for any mistakes while writing in English.

I need help I just started a flight simulator without templates based on what was written in the german gamestudio magazine (not AUM) The code is very messed up but it is my first try.
Now I have several problems I need a speedometer, an altimeter an so on. Unfortunately I was not able to find any real help here so maybe someone can help me by posting a working code for this here.
This is what I habe so far:

// FlightSim.wdl
include wetter.wdl;

var video_mode = 8;
var video_screen = 1;

var schub_var = 200;
var speed_var[3];
var speed_vec_1[3];
var speed_vec_2[3];
var soundhandle;
var soundtune;
var hoehe;


font arial_font = "Arial",1,20; // truetype font

string level_str = <FlightSim.wmb>;
sound prop_snd = <propeller.wav>;


sky sky1
{
type = <sky1_small+6.tga>;
flags = cube,visible;
layer = 1;
}

sky clouds1
{
type = <clouds01+6.tga>;
flags = cube,visible;
layer = 2;
}



function main
{

warn_level = 2;
clip_size = 0;
freeze_mode = 1;
level_load(level_str);
wait(3);
freeze_mode = 0;
camera.clip_far = 200000;
camera.clip_near = 1;
camera.arc=80;


while(1)
{

schub_var+ = joy_1 * 10 * time;
schub_var+ = key_w * 10 * time;
schub_var- = joy_2 * 10 * time;
schub_var- = key_s * 10 * time;
schub_var = clamp(schub_var, 0, 500);
wait(1);
}

}



function geschwindigkeit
{
while(1)
{
vec_for_vertex(speed_vec_1, my, 3);
wait(16);
vec_for_vertex(speed_vec_2, my, 3);
speed_var=vec_dist(speed_vec_1, speed_vec_2);
speed_var* = 0.0625*10;
hoehe=(my.z)*0.5;
}
}

function propellersound
{
soundhandle = ent_playloop (my, prop_snd, 30);
while(1)
{
soundtune=schub_var/5+50;
snd_tune(soundhandle, 0, soundtune, 0);
wait(1);
}
}

action flugzeug_phys
{
my.transparent = off;
my.alpha = 10;
phent_settype(my, ph_rigid, ph_sphere);
phent_setmass(my, 10, ph_sphere);
phent_setfriction(my, 0);
phent_setdamping(my,50, 50);
phent_setelasticity(my, 0, 0);
ph_setgravity(vector(0,0,-10));
phent_setmaxspeed (my, 30000, 5);
geschwindigkeit();
propellersound();
while(1)
{
vec_set(camera.x,my.x);
vec_set(camera.z, my.z );
vec_set(camera.pan, my.pan);
vec_set(camera.tilt, my.tilt);
vec_set(camera.roll, my.roll);
vec_set(camera.x,vector(-20,0,8));
vec_rotate(camera.x,my.pan);
vec_add(camera.x,my.x);
vec_set(camera.pan,nullvector);
ang_add(camera.pan,my.pan);



phent_addforcelocal(my, vector(schub_var,0,0), vector(0,0,0));
temp.x = 0.8*(joy_force.x-(key_cul - key_cur))*time;
temp.y = 0.4*(joy_force.y-(key_cud - key_cuu))*time;
temp.z = -0.4*(joy_force.x-(key_cul - key_cur))*time;
phent_addtorquelocal(my, temp);

wait(1);
}
}

include Uhr.wdl;

panel kontroll_pnl
{
pos_y=700;
digits =0,0,5,arial_font,0.2,schub_var;
digits =0,20,5,arial_font,100,speed_var.x;
digits =0,40,5,arial_font,1,hoehe;
layer = 10;
flags = visible, overlay;
}

text kontroll_text
{
pos_x=100;
pos_y=700;
string = "Schubkraft Prozent\nGeschwindigkeit km/h\nHöhe m über NN";
flags = visible;
font = arial_font;
}



string txt1 = "VARGURS FLIGHSIMULATOR VERSION 0.01 ALPHA";
font standard_font = "Arial",1,20;

text TextFenster
{
pos_x = 200;
pos_y = 60;
font = standard_font;
strings = 5;
string = txt1;
flags = visible;
}

include compass.wdl;
include cockpit.wdl;
include tacho.wdl;

And this is the tacho.wdl (these are only the bitmaps I wanna use for the speedometer so far):

bmap bmap_background = <tacho.tga>;
panel Tacho
{
pos_x = 0;
pos_y = 0;
layer = 1;
bmap = bmap_background;
needle(10,10,"zeigerklein.tga",10,2,180,0,100,my_var);
flags = visible, overlay;
}
bmap tachonadel,<zeigergross.tga>;

panel nadel
{
pos_x = 0;
pos_y = 0;
layer = 2;
bmap = tachonadel;
flags =visible,overlay,refresh;
}

So how can I get the needle to work?
What about an altimeter, vertical gyro?
Please help me

By the way is it possible to have different viewmodes? At the moment I have only a third person view as you can see by looking at the code.






Last edited by vargur; 02/11/09 16:48.