Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /// @description shit i sUKCkfsak
- //keyboard player input
- key_left = keyboard_check(vk_left) || keyboard_check(ord("A"));
- key_right = keyboard_check(vk_right) || keyboard_check(ord("D"));
- key_jump = keyboard_check_pressed(vk_space) || keyboard_check(ord("X"));
- key_down = keyboard_check(vk_down) || keyboard_check(ord("S"));
- //key_up = keyboard_check(vk_up) || keyboard_check(ord("W"));
- key_shoot = (mouse_check_button(mb_left)) || keyboard_check(ord("Z"));
- key_shift = keyboard_check(vk_shift)
- //calculate movement
- var move = key_right - key_left;
- hsp = move * walksp;
- vsp = vsp + grv;
- if (key_right)
- {
- direction = 0;
- }
- if (key_left)
- {
- direction = 180;
- }
- //ducking
- if (place_meeting(x,y+1,oParentWall)) && (key_down)
- {
- hsp = move * 0;
- key_shoot = 0;
- key_jump = 0;
- }
- //jumping
- if (place_meeting(x,y+1,oParentWall)) && (key_jump)
- {
- jumping = true;
- vsp = -7;
- }
- //sliding
- if ((slide >= 0) && (key_down) && (key_shift)) || (sliding)
- {
- slide = slide - 1;
- hsp = (lengthdir_x(4,direction));
- vsp = vsp + grv;
- sliding = true;
- alarm[1] = 25; //wait time for sliding
- if slide < 0
- {
- hsp = 0;
- sliding = false;
- slide = -1;
- }
- }
- //horizontal collision
- if (place_meeting(x+hsp,y,oParentWall))
- {
- while (!place_meeting(x+sign(hsp),y,oParentWall))
- {
- x = x + sign(hsp);
- }
- hsp = 0;
- }
- x = x + hsp;
- //vertical collision
- if (place_meeting(x,y+vsp,oParentWall))
- {
- while (!place_meeting(x,y+sign(vsp),oParentWall))
- {
- y = y + sign(vsp);
- }
- vsp = 0;
- }
- y = y + vsp;
- //shooting
- firingdelay = firingdelay - 1;
- if key_shoot && (firingdelay < 0)
- {
- //sprite_index = sMumuShoot;
- firingdelay = 10;
- with (instance_create_layer(x,y,"Bubble",oBubble))
- {
- speed = 5;
- image_xscale = other.image_xscale;
- hspeed = sign(image_xscale)*5;
- }
- }
- //animation
- if (!place_meeting(x,y+1,oParentWall))
- {
- sprite_index = sMumuJump;
- image_speed = 0;
- if (sign(vsp) > 0) image_index = 1;
- else image_index = 0;
- }
- else
- {
- image_speed = 1;
- if (hsp == 0)
- {
- sprite_index = sMumuIdle;
- }
- else
- {
- sprite_index = sMumuRun;
- }
- }
- if key_down
- {
- sprite_index = sMumuDown;
- image_speed = 0;
- image_index = 0;
- }
- //if key_up
- //{
- // sprite_index = sMumuLook;
- //}
- if sliding
- {
- sprite_index = sMumuSlide;
- image_speed = 0;
- image_index = 0;
- }
- //sprite flip
- if (hsp !=0)
- {
- image_xscale = sign(hsp);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement