]> vgcfreebox.myrthtech.pt Git - gm-duelo.git/blob - objects/obj_player/Other_10.gml
player object
[gm-duelo.git] / objects / obj_player / Other_10.gml
1 /// @description IDLE
2 sprite_index = asset_get_index(_my_spr_idle);
3 image_speed = 1;
4 _hsp = 0;
5
6 if(_grounded){
7 if((_right!=0 or _left!=0)){
8 _state = HERO.MOVE;
9 }
10
11 if(_up and alarm[0]=-1 ){
12 _state = HERO.JUMP;
13 _vsp = _jump;
14 audio_play_sound(snd_jump,10,false);
15 part_particles_burst(global._ps_jump_ef,x,y+sprite_height/2,ps_jump_ef);
16 alarm[0] = _jump_timer;
17 }
18
19 if(_down){
20 _state = HERO.CROUCH;
21 }
22 }else{
23 _hsp = (_right - _left);
24 if( place_meeting(x+sign(_hsp),y,obj_wall) ){
25 _state = HERO.WALL;
26 }
27
28 // allow jump near wall
29 if(_up and ( place_meeting(x+sprite_width/2,y,obj_wall) or place_meeting(x-sprite_width/2,y,obj_wall) )){
30 _state = HERO.JUMP;
31 _vsp = _jump;
32 part_particles_burst(global._ps_jump_ef,x,y+sprite_height/2,ps_jump_ef);
33 alarm[0] = _jump_timer;
34 }
35
36 }
37
38 if(_melee_atk and alarm[1] = -1){
39 image_index = 0;
40 alarm[1] = _attack_timer;
41 _state = HERO.ATTACK;
42 }
43
44 if(_evasion and alarm[5] = -1){
45 image_index = 0;
46 alarm[5] = _special_cd;
47 _state = HERO.EVASION;
48 }
49
50 if(_range_atk and not _melee_atk){
51 image_index = 0;
52 _state = HERO.SHOOT;
53 }