]> vgcfreebox.myrthtech.pt Git - gm-duelo.git/blob - objects/obj_player/Other_16.gml
player object
[gm-duelo.git] / objects / obj_player / Other_16.gml
1 /// @description SHOOT
2 sprite_index = asset_get_index(string(_my_spr_shoot));
3 _hsp = 0;
4
5 if(_range_atk and image_index < 1){
6 // point direction
7 image_speed = 0;
8 if(_grounded){
9 if(_up){_shoot_dir+=2;}
10 else if(_down){_shoot_dir-=2}
11 else{
12 if(_shoot_dir > 0){_shoot_dir-=1;}
13 if(_shoot_dir < 0){_shoot_dir+=1;}
14 }
15 if(_shoot_dir > 90){_shoot_dir=90;}
16 if(_shoot_dir < -75){_shoot_dir=-75;}
17 }
18
19
20 if(_melee_atk){
21 image_speed = 1;
22 image_index = 5;
23 }
24 }else{
25 image_speed = 1;
26 if(image_index < 0.4){
27 if(_amount_of_bullets > 0 ){
28 if(_my_bullet_type == "obj_bullet"){
29 audio_play_sound(snd_glock_shoot,10,false);
30 }else if(_my_bullet_type == "obj_kunai"){
31 audio_play_sound(snd_throw,10,false);
32 }
33
34 //audio_play_sound_ext(global._pistol_snd);
35 if(not(_grounded)){
36 var _blt_dir;
37 var _blt_x = 12*image_xscale;
38 var _blt_y = 8;
39 if(_up){
40 if _right _blt_dir = 45;
41 else if _left _blt_dir = 135;
42 else _blt_dir = 90; _blt_x = 0; _blt_y = 14;
43 }else if(_down){
44 if _right _blt_dir = 315;
45 else if _left _blt_dir = 225;
46 else _blt_dir = 270; _blt_x = 0; _blt_y = -14;
47 }else{
48 if image_xscale = 1 _blt_dir = 0
49 if image_xscale = -1 _blt_dir = 180;
50 }
51
52 var _my_bullet = instance_create_layer(x + _blt_x, y - _blt_y, "Instances", asset_get_index(string(_my_bullet_type)), {direction : _blt_dir});
53 _amount_of_bullets--;
54 }
55 // aim shoot
56 if(_grounded){
57 var _blt_x = 12*image_xscale;
58 var _blt_y = 8;
59 if(image_xscale == -1){_shoot_dir = 180 - _shoot_dir}
60 var _my_bullet = instance_create_layer(x + _blt_x, y - _blt_y, "Instances", asset_get_index(string(_my_bullet_type)), {direction : _shoot_dir});
61 _amount_of_bullets--;
62 }
63 }else{
64 //audio_play_sound(snd_empty_gun,10,false);
65 }
66 }
67 if(image_index > 9){
68 _state = HERO.IDLE;
69 _shoot_dir = 0;
70 }
71 if(!_grounded){_state = HERO.JUMP;image_index = 1;_shoot_dir = 0;}
72 }