]> vgcfreebox.myrthtech.pt Git - gm-duelo.git/blob - objects/obj_player/Other_13.gml
player object
[gm-duelo.git] / objects / obj_player / Other_13.gml
1 /// @description ATTACK
2 sprite_index = asset_get_index(string(_my_spr_attack));
3 image_speed = 1;
4 _hsp = sign(_hsp);
5
6 if(image_index < 1){
7 audio_play_sound(snd_melee_attack,10,false);
8 }
9
10 // samurai style - model attack 4
11 if(sprite_index == spr_samurai_attack or sprite_index == spr_model_attack_4){
12 if(image_index > 0 and image_index < 9){
13 var _to_hit = collision_point(x+24*image_xscale,y,obj_player,true,true);
14 if(_to_hit){
15 if(_to_hit._state == HERO.ATTACK){
16 audio_play_sound(snd_sword_hit_sword,10,false);
17 var _efx = choose(effect_create_above(ef_ring,x,y,0,c_white), effect_create_above(ef_ellipse,x,y,0,c_white) );
18 _hsp = -image_xscale * 15;
19 _vsp = -10;
20 }else if(_to_hit._state != HERO.HIT and _to_hit._state != HERO.DEAD and _to_hit._state != HERO.ROLL){
21 _to_hit._state = HERO.HIT;
22 }
23 }
24 if(image_index > 5 and image_index < 6){audio_play_sound(snd_melee_attack,10,false);}
25 }
26
27 if(image_index > 8){
28 _state = HERO.IDLE;
29 }
30 if(image_index > 3 and _melee_atk = 0){
31 _state = HERO.IDLE;
32 }
33 }
34
35 // sabre style
36 if(sprite_index == spr_pirate_attack or sprite_index = spr_alentejano_attack){
37 if(image_index > 1 and image_index < 4){
38 var _to_hit = collision_point(x+16*image_xscale,y,obj_player,true,true);
39 if(_to_hit){
40 if(_to_hit._state == HERO.ATTACK){
41 audio_play_sound(snd_sword_hit_sword,10,false);
42 var _efx = choose(effect_create_above(ef_ring,x,y,0,c_white), effect_create_above(ef_ellipse,x,y,0,c_white) );
43 _hsp = -image_xscale * 15;
44 _vsp = -10;
45 }else if(_to_hit._state != HERO.HIT and _to_hit._state != HERO.DEAD and _to_hit._state != HERO.ROLL){
46 _to_hit._state = HERO.HIT;
47 }
48 }
49 }
50
51 if(image_index > 5){
52 _state = HERO.IDLE;
53 }
54 }
55
56 // jab style
57 if(sprite_index == spr_model_jab){
58 if(image_index > 0 and image_index < 8){
59 var _to_hit = collision_point(x+8*image_xscale,y,obj_player,true,true);
60 if(_to_hit){
61 if(_to_hit._state == HERO.ATTACK){
62 var _efx = choose(effect_create_above(ef_ring,x,y,0,c_white), effect_create_above(ef_ellipse,x,y,0,c_white) );
63 _hsp = -image_xscale * 15;
64 _vsp = -10;
65 }else if(_to_hit._state != HERO.HIT and _to_hit._state != HERO.DEAD and _to_hit._state != HERO.ROLL){
66 _to_hit._state = HERO.HIT;
67 //_to_hit._health += 0.5;
68 }
69 }
70 }
71
72 /*if(image_index > 8 and _evasion){
73 sprite_index = spr_model_punch;
74 _state = HERO.ATTACK;*/
75 if(image_index > 9){
76 _state = HERO.IDLE;
77 }
78 }