mory مدیر انجمن
تاريخ عضويت: 3 شنبه 3 خرداد 1384 تعداد ارسالها: 1187
جمعه 27 آبان 1384 - 06:40 |
|
|
مرسي از همتون .
اون شخص رو هم دارم . تو اين پست خودم توضيح دادم . ولي هر كسي آرزوشه كه چند نفر مثل شماها دور و برش باشن و بهش همفكري بدن . متاسفانه مطمپنم ساعت هاي كاري من با هيچ كدوم از شما ها نمي خونه . من ساكن بندر انزلي ام . فكر هم نميكنم تو اين نزديكيا هم كسي از شماها رو بشه پيدا كرد .
http://www.persian-designers.com/forum/viewtopic.php?t=1173&sid=84317dd697bad31d35a04d01e2885bc8
اما
كسي كه برنامه نويسي سرباز دشمنش چنين حجمي داره (كدهاي زير- تازه هنوز هم بايد تكميل شه ) مطمپنا اجازه نميده چنين چيزهاي مهمي (يعني خط داستاني بازي )از دستش در بره .
توضيح كد . اين كم كم داره پا رو از هوش مصنوعي هم فراتر ميزاره .سرباز ها خيلي طبيعي رفتار ميكنن و به خيلي از چيز ها عكس العمل نشون ميدن . يه اينفورميشن از برنامه سرباز هاي دشمن گرفتم ببينين .ترسناكه نه ؟ و موقع اجرا زيباست . الان ميشه رو سربازها چشم گذاشت و منطقه ديدشون رو نگاه كرد . دقيقا مثل كاماندو . تو اينكار حداكثر توان گيم ميكر رو استفاده كردم .مثل اين ميمونه كه با پيكان 140 تا بري . ولي انصافا موتور خوبيه . تقريبا به من نه نميگه .
كد: |
Information about object: enemyparent1
Sprite: spriteright
Solid: false
Visible: true
Depth: -9
Persistent: false
Parent: <no parent>
Mask: mask
Create Event:
execute code:
image_index=0;image_speed=0;image_xscale=1;image_yscale=1;
sprite_index=spriteright ;
xx=x;rdirection=0;dotime=0; stay=true;
yy=y;z=.01;sp=1;
image_index=-1;
z=0;moving=false;
editx=1
edity=1
//
gunman=false;shottime=5;gunsound=true;
show_position=false;
instance_create(x,y,ob_position);
//
timer=0;step=1;imspeed=1;snplay=false;gunman_time=0;fire_time=0;
Alarm Event for alarm 0:
execute code:
a=1;gunman=true;
Alarm Event for alarm 1:
execute code:
a=0;gunman=true;
Step Event:
perform a step towards position (xx,yy) with speed sp avoiding solid only
execute code:
dotime+=1;sp=1.2;image_speed=imspeed;
if shottime <1000 shottime+=1 else shottime=5;
//
if (dotime>5 )
{
rdirection=round(direction);dotime=0
/*right*/ if (rdirection<=020 or rdirection>=340){sprite_index=spriteright;}
/*right-up*/ if (rdirection>=020 and rdirection<=70){sprite_index=sprite_u_r;}
/*up*/ if (rdirection>=070 and rdirection<110){sprite_index=spriteup;}
/*up-left*/ if (rdirection>=110 and rdirection<160){sprite_index=sprite_u_l;}
/*left*/ if (rdirection>=160 and rdirection<200){sprite_index=spriteleft;}
/*left-down*/if (rdirection>=200 and rdirection<250){sprite_index=sprite_d_l;}
/*down*/ if (rdirection>=250 and rdirection<290){sprite_index=spritedown;}
/*down-r*/ if (rdirection>=290 and rdirection<340){sprite_index=sprite_d_r;}
}
//check for reach//
if (abs(xx-x)<2 and abs(yy-y)<2 and gunman=false) {stay=true xx=x;yy=y;image_speed=.3 sprite_index=sprite_stay} else stay=false ;
if gunman=true {stay=false;sp=0;xxx=mouse_x;yyy=mouse_y;sprite_index=sp_gunman1;image_speed=0;}
execute code:
if gunman_time>10000 gunman_time=50 else gunman_time+=1;
if timer>2000 timer=0 else timer+=1;
if fire_time>10000 fire_time=50 else fire_time+=1;
if stay=true direction=270;
if gunman=false
{
if timer < 400+random(300) and step=1 {xx=random(room_width) ;yy=random(room_height) ;step=2}
if timer < 900+random(300) and timer>400 and step=2 {xx=random(room_width); yy=random(room_height); step=3}
if timer < 1400+random(300) and timer>800 and step=3 {xx=random(room_width); yy=random(room_height); step=1 ; timer=0}
if collision_point(xx,yy,rigid,1,0) {if xx<room_width-30 xx+=3 else xx-=3; if xx<room_height-100 xx+=3 else xx-=3}
}
if (distance_to_object(oo)<10 or a=1 and gunman_time>fps/10)
{
if collision_line(x,y,oo.x,oo.y,rigid,1,0)<0 {
gunman=true;xx=oo.x;yy=oo.y; xxx=oo.x-2+random(4);yyy=oo.y-3+random(6)
if snplay=false {sound_play(sn_rifle_reload) snplay=true}
}
else{gunman=false }
}
else
{gunman=false;snplay=false if gunman_time>90 gunman_time=0}
//fire to enemy
if gunman=true { fire_time+=1 if fire_time>150+random(50) {instance_create(oo.x,oo.y,ob_bullet_rifle);fire_time=0} } else fire_time=0 ;
End Step Event:
set variable depth to -y
Collision Event with object ob_bullet_rifle:
execute code:
with(self) instance_destroy();
Draw Event:
execute code:
//drawing view
if stay=false {
z_rad=degtorad(-direction+15);
z_rad2=degtorad(-direction-15);
z_rad3=degtorad(-direction);
x2=x+300*cos(z_rad);y2=y+150*sin(z_rad);
x3=x+300*cos(z_rad2);y3=y+150*sin(z_rad2);
x4=x+300*cos(z_rad2);y4=y+150*sin(z_rad2);
draw_triangle(x,y,x2,y2,x3,y3,-1)
for (i=0 ;i<40 ;i+=2 )
{
z_rad=degtorad(-direction-20+i);
x2=x+300*cos(z_rad);y2=y+150*sin(z_rad);
draw_line(x,y,x2,y2);if i>0 draw_line(x2,y2,x3,y3)
x3=x2;y3=y2;
if collision_line(x,y,x2,y2,oo,1,1) {alarm[0]=fps/5 doalarm=1 a=1} else {if doalarm=1{ alarm[1]=fps/5 ; doalarm=0}};
}
/////
/*saye*/draw_sprite_ext(sprite_index,image_index,x,y,.8,.1,0,c_black,.4);
if gunman=true
{draw_sprite_ext(sp_hadaf3,-1,xxx,yyy-10,1,1,45,c_blue,1);draw_sprite_ext(sprite_index,direction/10,x,y,0.6,0.6,0,c_green,1)}
//
if (stay=true) draw_sprite_ext(sprite_stay,-1,x,y,0.6,0.6,0,c_green,1);
if (stay=false && gunman=false) draw_sprite_ext(sprite_index,-1,x,y,0.6,0.6,0,c_green,1)
//
Key Release Event for G-key Key:
execute code:
//if gunman=false { gunman=true;sound_stop(sn_footstep);sound_play(sn_rifle_reload) } else {gunman=false;xx=x;yy=y sound_play(sn_rifle_reload2)}
|
|
_________________ و مهم نيست كي پنيرتو دزديده قورباغتو قورت بده .
|
|