Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- kleft = keyboard_check(vk_left);
- kright = keyboard_check(vk_right);
- kjump = keyboard_check_pressed(vk_space);
- var move = kright - kleft;
- hsp = move * 4;
- vsp += grv;
- if(keyboard_check_pressed(vk_escape))
- {
- room_goto(startmenu);
- }
- if(keyboard_check_pressed(ord('R')))
- {
- room_restart();
- }
- if(kjump)
- {
- if(place_meeting(x,y+1,ground))
- {
- doublejump=1;
- if(vsp >= 0)
- {
- vsp = -5;
- }
- else
- {
- vsp -= 5;
- }
- global.jumps += 1;
- if(sounds)
- {
- audio_play_sound(jump,1,false);
- }
- }
- else if(!place_meeting(x,y+1,ground)) and (doublejump=1)
- {
- if(vsp >= 0)
- {
- vsp = -5;
- }
- else
- {
- vsp -= 5;
- }
- doublejump=0;
- global.jumps += 1;
- if(sounds)
- {
- audio_play_sound(jump,1,false);
- }
- }
- }
- var hsp_final = hsp+hsp_carry;
- hsp_carry = 0;
- if(place_meeting(x+hsp_final,y,ground))
- {
- while(!place_meeting(x+sign(hsp_final),y,ground))
- {
- x+=sign(hsp_final);
- }
- hsp=0;
- }
- if(place_meeting(x,y+vsp,ground))
- {
- while(!place_meeting(x,y+sign(vsp),ground))
- {
- y+=sign(vsp);
- }
- vsp=0;
- doublejump=1;
- }
- if vsp < 0 and keyboard_check_released(vk_space)
- {
- vsp *= 0.25;
- }
- x+=hsp_final;
- y+=vsp;
- if(vsp=0)
- {
- if(hsp=0)
- {
- sprite_index = spr_itmeIdle;
- image_speed = 0.025;
- }
- else if (hsp>0)
- {
- sprite_index = spr_itmeMoving;
- image_xscale = 1;
- image_speed = 0.1;
- }
- else if (hsp<0)
- {
- sprite_index = spr_itmeMoving;
- image_xscale = -1;
- image_speed = 0.1;
- }
- }
- if(!place_meeting(x,y+1,ground))
- {
- if (vsp>0) and (hsp>=0)
- {
- sprite_index = spr_itmeFalling;
- image_xscale = 1;
- }
- else if (vsp<0) and (hsp>=0)
- {
- sprite_index = spr_itmeJumping;
- image_xscale = 1;
- }
- else if (vsp>0) and (hsp<=0)
- {
- sprite_index = spr_itmeFalling;
- image_xscale = -1;
- }
- else if (vsp<0) and (hsp<=0)
- {
- sprite_index = spr_itmeJumping;
- image_xscale = -1;
- }
- }
- if place_meeting(x,y,ground)
- {
- x = xprevious;
- }
- if(place_meeting(x,y,death))
- {
- room_goto(you_got_an_f);
- }
- if(place_meeting(x,y+1,bouncer))
- {
- vsp=-8;
- if(!audio_is_playing(bounce))
- {
- audio_play_sound(bounce,1,false);
- }
- }
- if(place_meeting(x,y,congrutalions))
- {
- room_goto(levcomp);
- }
- global.time += 1;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement