pixeltroid
Member
I have a code that gets my player sprite to change to his ducking position...but there are several problems
1. Pressing the walk Left or right buttons causes him to slide on the ground in his crouching pose.
2. I am unable to shoot weapons that work when the shoot button is pressed down
3. I can shoot weapons that work when the shoot button is tapped... but the bullets origin point is the same as it is when he stands up so it looks as if the bullets are coming from the players head.
Here's my code for ducking in players step event
a) Not being able to move when I'm crouching.
b) Being able to shoot when the shoot button is pressed down.
c) Have the bullets origin lowered by a few pixels in crouching mode.
Any and all help will be appreciated.
1. Pressing the walk Left or right buttons causes him to slide on the ground in his crouching pose.
2. I am unable to shoot weapons that work when the shoot button is pressed down
3. I can shoot weapons that work when the shoot button is tapped... but the bullets origin point is the same as it is when he stands up so it looks as if the bullets are coming from the players head.
Here's my code for ducking in players step event
Here's the keypress function for the shoot button that needs to be pressed down//set to ducking
if keyboard_check(ord("S"))
{ ducking = true; }
else
{ ducking = false; }
//check to see if player on ground
if(place_meeting(x,y+1,obj_solid))
{
vspeed = 0;
grounded = true;
if(ducking)
{ hspeed = 0; }
if keyboard_check(ord("W"))
{ vspeed = -10; }
//display proper animation when on ground
if(grounded)
{
if(hspeed != 0)
{
sprite_index = spr_playerstand;
image_speed = .2;
}
else if(ducking)
{sprite_index = spr_playerduck;
hspeed = 0
}
}
}
the script for players shoot state://original
if (state == 'move' && canshoot = true && health > 0) {
audio_play_sound(sfx_herolaser,10,false)
image_speed = .3;
sprite_index = spr_playershoot;
state = 'playershoot' ;
}
Can someone go through my codes and tell me how to modify them to achieve:{
{
if (bullets > 2 && image_index >1) {
//create bullet
b=instance_create(x+4,y-4,obj_bullet);
bullets -= 1;
b.speed = 6;
//check direction
if (image_xscale > 0) {
b.direction = 0;
} else {
b.direction = 180;
}
}
a) Not being able to move when I'm crouching.
b) Being able to shoot when the shoot button is pressed down.
c) Have the bullets origin lowered by a few pixels in crouching mode.
Any and all help will be appreciated.