Advertisement
Guest User

Untitled

a guest
Jan 17th, 2017
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.11 KB | None | 0 0
  1. scr_player_bazooka
  2. //Get Inputs
  3. scr_bazooka_controls();
  4. ///Control Inputs
  5. rkey = keyboard_check(vk_right);
  6. lkey = keyboard_check(vk_left);
  7. jkey = keyboard_check_pressed(ord("A"));
  8. switchkey = keyboard_check_pressed(ord("Q"));
  9. skey = keyboard_check_pressed(ord("S"));
  10.  
  11. //Movement (SKIP)
  12. scr_player_physics();
  13. scr_player_friction();
  14. scr_player_direction();
  15.  
  16. //Collision (SKIP)
  17. scr_player_collision();
  18.  
  19. //Animation
  20. scr_bazooka_animation();
  21. //Animate
  22. if (sprite_index != spr_bazooka_switch)
  23. {
  24. if (yprevious != y)
  25. {
  26. sprite_index = spr_bazooka_jump;
  27. mask_index = spr_bazooka_mask;
  28. image_speed = 0.2;
  29. image_index = y>yprevious;
  30. }
  31. else
  32. {
  33. if (xprevious != x)
  34. {
  35. sprite_index = spr_bazooka_run;
  36. }
  37. else
  38. {
  39. sprite_index = spr_bazooka_idle;
  40. }
  41. }
  42. }
  43.  
  44. //Bullet Direction
  45. scr_bazooka_shoot();
  46. //Shooting
  47. if (skey)
  48. {
  49. instance_change(obj_player_shoot,false);
  50. }
  51.  
  52. scr_shoot_direction();
  53.  
  54. obj_player_shoot
  55. STEP EVENT
  56. //Gravity (Ensure no choppy going 'up' when jumping and firing)
  57. if (vspd < 10)
  58. {
  59. vspd += grav;
  60. }
  61.  
  62. //Horizontal Collisions
  63. if (place_meeting(x+hspd,y,obj_solid))
  64. {
  65. while (!place_meeting(x+sign(hspd),y,obj_solid)) x+= sign(hspd);
  66. hspd = 0;
  67. }
  68.  
  69. //Move Horizontally
  70. x += hspd;
  71.  
  72. //Vertical Collisions
  73. if (place_meeting(x,y+vspd,obj_solid))
  74. {
  75. while (!place_meeting(x,y+sign(vspd),obj_solid)) y+= sign(vspd);
  76. vspd = 0;
  77. }
  78.  
  79. //Move Vertically
  80. y += vspd;
  81.  
  82. //Shooting
  83. if (bullet > 0 && image_index > 2)
  84. {
  85. //Create bullet
  86. b=instance_create(x+40,y-24,obj_bullet_bazooka);
  87. bullet -= 1;
  88. b.speed = 12;
  89. b.image_speed = 0.2; //Includes attack Animation Speed
  90.  
  91. //Check direction
  92. if (image_xscale =1)
  93. {
  94. b.direction = 0;
  95. }
  96. else
  97. {
  98. b.direction = 180;
  99. }
  100. }
  101.  
  102. ANIMATION END EVENT
  103. {
  104. instance_change(obj_player,false);
  105. bullet = 1;
  106. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement