Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- scr_player_bazooka
- //Get Inputs
- scr_bazooka_controls();
- ///Control Inputs
- rkey = keyboard_check(vk_right);
- lkey = keyboard_check(vk_left);
- jkey = keyboard_check_pressed(ord("A"));
- switchkey = keyboard_check_pressed(ord("Q"));
- skey = keyboard_check_pressed(ord("S"));
- //Movement (SKIP)
- scr_player_physics();
- scr_player_friction();
- scr_player_direction();
- //Collision (SKIP)
- scr_player_collision();
- //Animation
- scr_bazooka_animation();
- //Animate
- if (sprite_index != spr_bazooka_switch)
- {
- if (yprevious != y)
- {
- sprite_index = spr_bazooka_jump;
- mask_index = spr_bazooka_mask;
- image_speed = 0.2;
- image_index = y>yprevious;
- }
- else
- {
- if (xprevious != x)
- {
- sprite_index = spr_bazooka_run;
- }
- else
- {
- sprite_index = spr_bazooka_idle;
- }
- }
- }
- //Bullet Direction
- scr_bazooka_shoot();
- //Shooting
- if (skey)
- {
- instance_change(obj_player_shoot,false);
- }
- scr_shoot_direction();
- obj_player_shoot
- STEP EVENT
- //Gravity (Ensure no choppy going 'up' when jumping and firing)
- if (vspd < 10)
- {
- vspd += grav;
- }
- //Horizontal Collisions
- if (place_meeting(x+hspd,y,obj_solid))
- {
- while (!place_meeting(x+sign(hspd),y,obj_solid)) x+= sign(hspd);
- hspd = 0;
- }
- //Move Horizontally
- x += hspd;
- //Vertical Collisions
- if (place_meeting(x,y+vspd,obj_solid))
- {
- while (!place_meeting(x,y+sign(vspd),obj_solid)) y+= sign(vspd);
- vspd = 0;
- }
- //Move Vertically
- y += vspd;
- //Shooting
- if (bullet > 0 && image_index > 2)
- {
- //Create bullet
- b=instance_create(x+40,y-24,obj_bullet_bazooka);
- bullet -= 1;
- b.speed = 12;
- b.image_speed = 0.2; //Includes attack Animation Speed
- //Check direction
- if (image_xscale =1)
- {
- b.direction = 0;
- }
- else
- {
- b.direction = 180;
- }
- }
- ANIMATION END EVENT
- {
- instance_change(obj_player,false);
- bullet = 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement