Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- kleft = keyboard_check(vk_left);
- kright = keyboard_check(vk_right);
- kup = keyboard_check(vk_up);
- kdown = keyboard_check(vk_down);
- shutdown = keyboard_check(vk_escape);
- shoot = keyboard_check(vk_space);
- moveh = kright - kleft;
- movev = kdown - kup;
- shot = instance_create(x,y,bulletplayer);
- hsp = moveh * 4; //>0 right
- vsp = movev * 4; //>0 down
- if (draw == false)
- {
- x += hsp;
- y += vsp;
- }
- if (place_meeting(x,y,solids))
- {
- x = xprevious;
- y = yprevious;
- }
- if shoot
- {
- if hsp>0
- {
- if vsp>0
- {
- with(shot)
- {
- hsp = 4;
- vsp = 4;
- }
- }
- else if vsp<0
- {
- with(shot)
- {
- hsp = 4;
- vsp = -4;
- }
- }
- else if vsp==0
- {
- with(shot)
- {
- hsp = 4;
- vsp = 0;
- }
- }
- }
- else if hsp<0
- {
- if vsp>0
- {
- with(shot)
- {
- hsp = -4;
- vsp = 4;
- }
- }
- else if vsp<0
- {
- with(shot)
- {
- hsp = -4;
- vsp = -4;
- }
- }
- else if vsp==0
- {
- with(shot)
- {
- hsp = -4;
- vsp = 0;
- }
- }
- }
- else if hsp==0
- {
- if vsp>0
- {
- with(shot)
- {
- hsp = 0;
- vsp = 4;
- }
- }
- else if vsp<0
- {
- with(shot)
- {
- hsp = 0;
- vsp = -4;
- }
- }
- else if vsp==0
- {
- with(shot)
- {
- hsp = choose(0,4,-4);
- vsp = choose(0,4,-4);
- }
- }
- }
- }
- if shutdown game_end();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement