2 registered members (OptimusPrime, AndrewAMD),
14,580
guests, and 5
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
How to make working dials
#250970
02/11/09 00:21
02/11/09 00:21
|
Joined: Jun 2008
Posts: 21 M-V, Germany
vargur
OP
Newbie
|
OP
Newbie
Joined: Jun 2008
Posts: 21
M-V, Germany
|
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.
|
|
|
Re: How to make working dials
[Re: vargur]
#250974
02/11/09 00:58
02/11/09 00:58
|
Joined: Jan 2008
Posts: 1,580
Blade280891
Serious User
|
Serious User
Joined: Jan 2008
Posts: 1,580
|
In the lite-c tutorials their is an example of an altimeter
My Avatar Randomness V2"Someone get me to the doctor, and someone call the nurse And someone buy me roses, and someone burned the church"
|
|
|
Re: How to make working dials
[Re: Widi]
#251166
02/11/09 20:41
02/11/09 20:41
|
Joined: Nov 2007
Posts: 1,032 Croatia
croman
Serious User
|
Serious User
Joined: Nov 2007
Posts: 1,032
Croatia
|
no need for 3d sphere model. he could also use an animated bmap, and just change it's frame parameter. less resources and easier to do, if you ask me
Ubi bene, ibi Patria.
|
|
|
Re: How to make working dials
[Re: Widi]
#251212
02/11/09 23:46
02/11/09 23:46
|
Joined: Jun 2008
Posts: 21 M-V, Germany
vargur
OP
Newbie
|
OP
Newbie
Joined: Jun 2008
Posts: 21
M-V, Germany
|
Thanks a lot Widi but I am a beginner maybe you could give me more details?
Would be wonderful if u implicate the code I posted if possible. Thank you for your effort anyways
Last edited by vargur; 02/11/09 23:49.
|
|
|
Re: How to make working dials
[Re: vargur]
#251367
02/12/09 19:14
02/12/09 19:14
|
Joined: Jun 2008
Posts: 21 M-V, Germany
vargur
OP
Newbie
|
OP
Newbie
Joined: Jun 2008
Posts: 21
M-V, Germany
|
I'm working at the gyro already up and down works already and I have found another example where the rolling also works but I have to modify the code for my project. Maybe you could help me with this. This is what works so far:panel horz_pan = { bmap = "horzupper.tga"; pos_x = 512; pos_y = 464; layer = 6; flags = OVERLAY, VISIBLE; } panel horizont_pan = { window (536, 488, 80, 80, hudhorizont.bmp, 0, hoehe); flags = VISIBLE; layer = 5; } //instrument horizont function horizontkippen() { horizont_pan.center_x = 576; horizont_pan.center_y = 496+32; } and this is the aprt that needs to be modified for my needs://instrument horizont function horizontkippen() { horizont_pan.center_x = 576; horizont_pan.center_y = 496+32; while (1) { //pitch sidewards horizont_pan.angle = integer(-roll); //Horizont auf Neigungshöhe einstellen pitch=-tillt+185; wait(1); } } And last but not least a screenshot of my project:Speedometer, Altimeter and compass are already working 
Last edited by vargur; 02/12/09 19:21.
|
|
|
Moderated by mk_1, Perro, rayp, Realspawn, Rei_Ayanami, rvL_eXile, Spirit, Superku, Tobias, TSG_Torsten, VeT
|