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
1 registered members (TipmyPip), 18,633 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
Rating: 5
Free seagull model, code and sound #79115
06/23/06 12:34
06/23/06 12:34
Joined: May 2002
Posts: 611
Germany => Bavaria => Unterfra...
LordRathan Offline OP
User
LordRathan  Offline OP
User

Joined: May 2002
Posts: 611
Germany => Bavaria => Unterfra...
I fiddled out this morning the code for birds. Now I'm happy it is working. It seems to me, that ent_animate is not working with pure vertex-animated models. *hehe* needed two hours to find that out.

Just place the model in WED (somewhere in the air, not more than 500 quants above the player (otherwise, change the distance in the alpha_ratio commandline)), attach the anml_moewe action to it and enjoy.

Code:

sound moewe_01 = "moewe_einzeln.wav";

define alpha_ratio, skill10;

action anml_moewe
{
var start_pos;
var bird_speed = 15; // flying speed
var flying_distance = 250; // flying distance from start position
var target_angle;
var moewe_schrei; // handle for sound

my.polygon = off; // set this on, if you want to interact with the bird
my.transparent = on;

my.pan = int(random(360)+1);
vec_set (start_pos.x, my.x); // store the initial position of the bird
vec_set (target_angle.pan, my.pan);

while (me)
{
if((int(random(100)) < 5) && (!snd_playing(moewe_schrei)))
{
moewe_schrei = ent_playsound(my, moewe_01, 300);
}

my.alpha_ratio = (3000 - (vec_dist(player.x, my.x))) / 450;
my.alpha = my.alpha_ratio * 100;
temp.x = bird_speed * time;
temp.y = 0;
temp.z = 0;

c_move (my, temp, nullvector, ignore_passable);

if(my.pan < target_angle.pan - 2)
{
my.pan += 1 * time;
my.flag1 = on;
}
else
{
my.flag1 = off;
}
if(my.pan > target_angle.pan + 2)
{
my.pan -= 1 * time;
my.flag1 = on;
}
else
{
my.flag1 = off;
}

my.skill40 = vec_dist(my.x, start_pos);

if ((my.skill40 > flying_distance) && (my.flag1 == off))
{
vec_set(temp,start_pos);
vec_sub(temp,my.x);
vec_to_angle(target_angle,temp);
}

if(my.skill20 <= 1)
{
my.anim_type = random(100) + 1;
}
if(my.anim_type < 70)
{
ent_animate(me, "flap", my.skill20, anm_cycle); // animate the bird
my.skill20 += 9 * time; // animation speed
my.skill20 %= 100; // loop animation
}
else
{
ent_animate(me, "glide", my.skill20, anm_cycle); // animate the bird
my.skill20 += 4 * time; // animation speed
my.skill20 %= 100; // loop animation
}

wait(1);
}
}



Maybe it is not the cleanest code you've ever seen, but it works fine for me. And maybe someone can use it.

RAR-File (includes model (untextured), code and sound) (18 kb)

Video (~ 3MB, AVI)

EDIT: Oups, used ent_cycle in the code... updated to ent_animate

EDIT2: Note: I've forgotten to define my.alpha_ratio. Define it at a free skill of your choice. I've added this in the postet code, line 3.

Last edited by LordRathan; 06/23/06 16:13.
Re: Free seagull model, code and sound [Re: LordRathan] #79116
06/23/06 12:41
06/23/06 12:41
Joined: Aug 2003
Posts: 511
Hilden in Germany
RobH Offline
User
RobH  Offline
User

Joined: Aug 2003
Posts: 511
Hilden in Germany
Absolt cool constribution. Thanks for that!!!!

Re: Free seagull model, code and sound [Re: LordRathan] #79117
06/23/06 13:29
06/23/06 13:29

A
Anonymous
Unregistered
Anonymous
Unregistered
A



Thanx!

Great to get a complete pack (model, code & sound)!
That saves some hours of work!

mercuryus

Re: Free seagull model, code and sound [Re: ] #79118
06/23/06 15:32
06/23/06 15:32
Joined: Mar 2006
Posts: 2,758
Antwerp,Belgium
frazzle Offline
Expert
frazzle  Offline
Expert

Joined: Mar 2006
Posts: 2,758
Antwerp,Belgium
The same here !!!!
Great work LordRathan

Last edited by frazzle; 06/23/06 15:32.

Antec® Case
Intel® X58 Chipset
Intel® i7 975 Quad Core
8 GB RAM DDR3
SSD OCZ®-VERTEX2 3.5 x4 ; HD 600 GB
NVIDIA® GeForce GTX 295 Memory 1795GB
Re: Free seagull model, code and sound [Re: frazzle] #79119
06/23/06 16:07
06/23/06 16:07
Joined: May 2002
Posts: 611
Germany => Bavaria => Unterfra...
LordRathan Offline OP
User
LordRathan  Offline OP
User

Joined: May 2002
Posts: 611
Germany => Bavaria => Unterfra...
Thank you all.

Re: Free seagull model, code and sound [Re: LordRathan] #79120
06/27/06 22:38
06/27/06 22:38
Joined: Sep 2002
Posts: 8,177
Netherlands
PHeMoX Offline
Senior Expert
PHeMoX  Offline
Senior Expert

Joined: Sep 2002
Posts: 8,177
Netherlands
Nice code, thanks for sharing ..

Cheers


PHeMoX, Innervision Software (c) 1995-2008

For more info visit: Innervision Software
Re: Free seagull model, code and sound [Re: PHeMoX] #79121
06/30/06 22:34
06/30/06 22:34
Joined: Aug 2002
Posts: 2,692
California, USA
bupaje Offline
Expert
bupaje  Offline
Expert

Joined: Aug 2002
Posts: 2,692
California, USA
Looks great, cool contribution.


Find me at: |Stormvisions| Twitter|

Moderated by  adoado, checkbutton, mk_1, Perro 

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