Gamestudio Links
Zorro Links
Newest Posts
ZorroGPT
by TipmyPip. 04/25/26 16:09
Z9 getting Error 058
by jcl. 04/24/26 17:48
Stooq now requires an API key
by jcl. 04/13/26 09:42
Strange "Alien" Skull created with >Knubber<
by NeoDumont. 04/10/26 18:58
400 free seamless texture pack downl. here !
by NeoDumont. 04/08/26 19:55
AUM Magazine
Latest Screens
Dorifto samurai
Shadow 2
Rocker`s Revenge
Stug 3 Stormartillery
Who's Online Now
2 registered members (TipmyPip, Grant), 3,308 guests, and 6 spiders.
Key: Admin, Global Mod, Mod
Newest Members
valino, juergenwue, VladMak, Geir, ondrej
19209 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 2 of 2 1 2
Re: question about programming tanks.. [Re: Helghast] #306243
01/20/10 17:35
01/20/10 17:35
Joined: Nov 2008
Posts: 196
the wrong place
Muhsin Offline OP
Member
Muhsin  Offline OP
Member

Joined: Nov 2008
Posts: 196
the wrong place
Hi!

here is the code im using for my tankbody:

---------------------------------------------------------------------------------
action player_tank()
{
ANGLE temp;

my.group = 2;

player = me;

ent_create("player_turret.mdl", vector(player.x, player.y, player.z + 10), player_turret);

while(1)
{
temp.tilt = 0;
temp.roll = 0;
temp.pan = -my.pan;
vec_rotate(normal, temp);
temp.tilt = -asinv(normal.x);
temp.roll = -asinv(normal.y);
my.tilt += 0.1 * ang(temp.tilt - my.tilt);
my.roll += 0.1 * ang(temp.roll - my.roll);

if (key_w || key_s)
{

var distance = (key_w-key_s)*5*time_step;
c_move(me, vector(distance,0,0), NULL, IGNORE_PUSH | GLIDE);

}

if (key_a && key_w)
{
my.pan += 1.1;
}

if (key_d && key_w)
{
my.pan -= 1.1;
}

if (key_a && key_s)
{
my.pan -= 1.1;
}

if (key_d && key_s)
{
my.pan += 1.1;
}

wait(1);
}
}
--------------------------------------------------------------------------------

and here is the code im using for the turret:

-------------------------------------------------------------------------------

action player_turret()
{


my.group = 2;

ent_create("player_one_barrel.mdl", vector(player.x, player.y, player.z), player_one_barrel);
ent_create("player_one_barrel_holder.mdl", vector(player.x, player.y, player.z), player_one_barrel_holder);

while(1)
{


vec_set(camera.x,vector (-500, 0, 230));
vec_rotate(camera.x,my.pan);
vec_add (camera.x, my.x);
camera.pan = my.pan;
camera.tilt = -20;

my.x = you.x;
my.y = you.y;
my.z = you.z;

if (key_cur)
{
my.pan -= 1;
}

if (key_cul)
{
my.pan += 1;
}

wait(1);
}
}

-------------------------------------------------------------------------------

thanks for the helps!!!

- Muhsin Kaymak


Come and play my new browsergame - Valley Of Wolves:

http://www.mafiacreator.com/ValleyOfWolves

Hurry and be the first to take over the different business' in the Valley Of Wolves, before anybody else does it!
And be the most feared MafiaBoss in the World!!
Re: question about programming tanks.. [Re: Muhsin] #306262
01/20/10 20:56
01/20/10 20:56
Joined: Nov 2008
Posts: 196
the wrong place
Muhsin Offline OP
Member
Muhsin  Offline OP
Member

Joined: Nov 2008
Posts: 196
the wrong place
does anyone know how to fix the problem?? i really need the help


thanks!

- Muhsin Kaymak


Come and play my new browsergame - Valley Of Wolves:

http://www.mafiacreator.com/ValleyOfWolves

Hurry and be the first to take over the different business' in the Valley Of Wolves, before anybody else does it!
And be the most feared MafiaBoss in the World!!
Re: question about programming tanks.. [Re: Muhsin] #306275
01/20/10 22:22
01/20/10 22:22
Joined: Mar 2006
Posts: 3,538
WA, Australia
J
JibbSmart Offline
Expert
JibbSmart  Offline
Expert
J

Joined: Mar 2006
Posts: 3,538
WA, Australia
Yes, look at the link I posted in my answer.

It should do exactly what you want laugh

Jibb


Formerly known as JulzMighty.
I made KarBOOM!
Page 2 of 2 1 2

Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

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