Gamestudio Links
Zorro Links
Newest Posts
Zorro 2.70
by jcl. 09/29/25 09:24
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
3 registered members (AndrewAMD, Ayumi, NewbieZorro), 14,141 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
How to make working dials #250970
02/11/09 00:21
02/11/09 00:21
Joined: Jun 2008
Posts: 21
M-V, Germany
V
vargur Offline OP
Newbie
vargur  Offline OP
Newbie
V

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 Offline
Serious User
Blade280891  Offline
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: Blade280891] #251106
02/11/09 16:47
02/11/09 16:47
Joined: Jun 2008
Posts: 21
M-V, Germany
V
vargur Offline OP
Newbie
vargur  Offline OP
Newbie
V

Joined: Jun 2008
Posts: 21
M-V, Germany
Do u mean the one in the manual? This one does not work for me unfortunately because I need a Altimeter looking and working like a clock (see image below) and it also does not teach how to build a speedometer or the vertical gyro( also called artificial horizon)

Here is an example of what I mean:

An Altimeter




A vertical gyro


A Spedometer or Airspeed Indicator




Last edited by vargur; 02/11/09 17:02.
Re: How to make working dials [Re: vargur] #251141
02/11/09 18:34
02/11/09 18:34
Joined: Aug 2007
Posts: 1,922
Schweiz
Widi Offline
Serious User
Widi  Offline
Serious User

Joined: Aug 2007
Posts: 1,922
Schweiz
The Altimeter and the speedometer should not a problem. Make two Panels, one with the background and one wiwh the needle. The needle you can turn around. Have a look at:
panel.center_x
panel.angle

That with the gyro is more complicatet. Maybe with a model, a sphere that you can change with pan, tilt, roll.

Re: How to make working dials [Re: vargur] #251163
02/11/09 20:29
02/11/09 20:29
Joined: Feb 2009
Posts: 9
mexico
J
jav Offline
Newbie
jav  Offline
Newbie
J

Joined: Feb 2009
Posts: 9
mexico
Hi I make application of virtual reality and i want use 3d Game Studio A7

I want to ask you if i want to generate stereoscopy o that method i need help you please¡¡¡¡

And i orientate me the aplication use for the virtual reality

Thanks for the answers

Jav

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 Offline
Serious User
croman  Offline
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: croman] #251185
02/11/09 21:14
02/11/09 21:14
Joined: Aug 2007
Posts: 1,922
Schweiz
Widi Offline
Serious User
Widi  Offline
Serious User

Joined: Aug 2007
Posts: 1,922
Schweiz
@cerberi_croman: Yes, you are right. With animated bmap it`s really easier. I don't think about that.

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
V
vargur Offline OP
Newbie
vargur  Offline OP
Newbie
V

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] #251338
02/12/09 16:34
02/12/09 16:34
Joined: Jun 2008
Posts: 21
M-V, Germany
V
vargur Offline OP
Newbie
vargur  Offline OP
Newbie
V

Joined: Jun 2008
Posts: 21
M-V, Germany
I found out another way. I just tried out the "needle" command and it worked perfectly for me. But I steel need help with the gyro

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
V
vargur Offline OP
Newbie
vargur  Offline OP
Newbie
V

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.

Gamestudio download | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1