W
Wild_West
Guest
Okay I was just about to start putting all the stuff I've coded together to make my for real game project, thought it was all working out since I hadn't spotted any errors on my very last test run in a separate practice file, and then I try some jumping with my player which I shuld be able to do in my sleep by this point , and of course , error. xD
For some reason, even though I am 100% sure this code was all working before just fine, my player
can't seem to jump anymore.
When he tries it's like his gravity has been erased, but the strange thing is, this ONLY happens if I jump WHILE already running, like holding left or right key and pressing the jump key.
Then if I just jump while standing still, he does jump but if I move while in the air, it's like the gravity is way less than it should be, he just starts hovering down, and when he lands he slides across the ground with whatecer direction he's going until friction stops him.
Now all the below code I had in one big script so his other objects could share everything, but I've tried separating it all into the specific events thinking something was colliding, but to no avail, everything moves the same messed up way no matter what changes I make, and have tried everything.
Removing bits, adding in extra condition checks, I even compared this to another project I had been testing stuff in where the jumping around was fine and couldn't see what was different .
So as someone who has done movement plenty of times before without this odd issue, I'm just stumped.
I hate to have to keep asking for so much help because I don't want to feel like an idiot because I can't see the answer but I've been looking at it all for ages now and don't know what to do.
This is all my object's info : Player Parent's enemy collision on top , playable character code on bottom.
---------------------------------------------------------------------------------------------------------------------------------------------
if( place_meeting(x, bbox_bottom,enemyParent ) )
{
vspeed = -9;
hspeed = choose(-10,10);
}
if not place_empty(bbox_right,y) and place_meeting(bbox_right,y,enemyParent)
{
move_bounce_all(false);
hp -= enemyParent.atk - grd;
}
if not place_empty(bbox_left,y) and place_meeting(bbox_left,y,enemyParent)
{
move_bounce_all(false);
hp -= enemyParent.atk - grd;
}
-------------------------------------------------------------------------------------------------------------------------------------------
Information about object: wildWest
Sprite: westSPR
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent: playerParent
Children:
Mask: westMaskSPR
No Physics Object
Step Event:
call the inherited event of the parent object
execute code:
///attacking and movement
allow_player_movement();
allow_gravity();
limit_hp(max_hp);
enable_combos( ord("A"), ord("Q") );
//target 1 specific enemy
target = instance_nearest(x,y,enemyParent);
//enable the slash attack
if(comboCounter = 1)perform_slash(ord("A"),westSlashSPR,3,slashDmgOBJ);
//enable the 1st slash combo
if(comboCounter= 2)perform_slash(ord("A"),westSlashComboSPR,3,slashComboDmgOBJ);
//enable the final slash combo
if(comboCounter = 3)perform_slash(ord("A"),westSlashEndSPR,3,slashEndDmgOBJ);
//enable multislash
perform_multiSlash(fullSlashComboSPR);
//do a slash in the air
if(place_free(x, y+1))perform_slash(ord("P"),westAirSlashSPR,3,airSlashDmgOBJ);
//do a rising slash
perform_rising_slash(westJumpSlashSPR);
//enable the hammer attack
perform_hammer(westHammerSPR);
//enable the stab
perform_stab(westStabSPR);
//--------------------------------------------------------------------------------
//Stop the animation freeze after an attack so the dmg obj doesn't stay longer than 1 frame
if(atkFrameStall <= 0){ atkFrameStall = room_speed * 1; }
execute code:
///Set Regular Image Speed for Each Attack Animation
if(image_speed = 0)
{
switch(sprite_index)
{
case westSlashSPR : image_speed = slashRegImgSpd; break;
case westSlashComboSPR : image_speed = slashRegImgSpd; break;
case westSlashEndSPR : image_speed = slashRegImgSpd; break;
case westAirSlashSPR : image_speed = slashRegImgSpd; break;
case fullSlashComboSPR : image_speed = multiSlashRegImgSpd; break;
case westHammerSPR : image_speed = hammerRegImgSpd; break;
case westStabSPR : image_speed = stabRegImgSpd; break;
case westJumpSlashSPR : image_speed = risingSlashRegImgSpd; break;
}
}
Keyboard Event for <Left> Key:
execute code:
///perfect jump animation
if place_free(bbox_left,y) and (move_left) and not(move_down)
{
x -= move_spd;
direction = 180;
image_xscale = -1;
//adjust running for ground only
if not place_free(bbox_left,y+1)
{
sprite_index = westRunningSPR;
image_xscale = -1;
image_speed = .6;
}
//adjust image facing for attacks
switch(sprite_index)
{
case westJumpSPR : image_xscale = 1; break;
case westJumpSlashSPR : image_xscale = -1; break;
case westAirSlashSPR : image_xscale = -1; break;
}
}
//adjust jump animation while moving
if(sprite_index = westJumpSPR){image_speed = 0; image_index = 3;}
Keyboard Event for <Right> Key:
execute code:
if place_free(bbox_right,y) and (move_right) and not(move_down)
{
x += move_spd;
direction = 0;
image_xscale = 1;
//adjust running for ground only
if not place_free(bbox_right,y+1)
{
sprite_index = westRunningSPR;
image_xscale = 1;
image_speed = .6;
}
//adjust image facing for attacks
switch(sprite_index)
{
case westJumpSPR : image_xscale = -1; break;
case westJumpSlashSPR : image_xscale = 1; break;
case westAirSlashSPR : image_xscale = 1; break;
}
}
if(sprite_index = westJumpSPR){image_speed = 0; image_index = 3;}
Keyboard Event for <Down> Key:
execute code:
///Crouch
if not place_free(x,y+1) and (move_down)
{
sprite_index = westCrouchingSPR;
mask_index = westCrouchingSPR;
}
Key Press Event for <Ctrl> Key:
execute code:
//Jump
if not place_free(x,y+1)
{
vspeed = -jump_height;
sprite_index = westJumpSPR;
image_speed = .1;
}
Key Press Event for <Space> Key:
Restart the current room
Key Release Event for <Left> Key:
execute code:
///back to idle so the whole animation doesn't have to end
if(sprite_index = westRunningSPR) sprite_index = westSPR;
Key Release Event for <Right> Key:
execute code:
///back to idle so the whole animation doesn't have to end
if(sprite_index = westRunningSPR) sprite_index = westSPR;
Key Release Event for <Down> Key:
execute code:
mask_index = westMaskSPR;
sprite_index = westSPR;
----------------------------------------------------------------------------------------------------------------------------------------
Any suggestions will help poor west out a lot lol Thanks
For some reason, even though I am 100% sure this code was all working before just fine, my player
can't seem to jump anymore.
When he tries it's like his gravity has been erased, but the strange thing is, this ONLY happens if I jump WHILE already running, like holding left or right key and pressing the jump key.
Then if I just jump while standing still, he does jump but if I move while in the air, it's like the gravity is way less than it should be, he just starts hovering down, and when he lands he slides across the ground with whatecer direction he's going until friction stops him.
Now all the below code I had in one big script so his other objects could share everything, but I've tried separating it all into the specific events thinking something was colliding, but to no avail, everything moves the same messed up way no matter what changes I make, and have tried everything.
Removing bits, adding in extra condition checks, I even compared this to another project I had been testing stuff in where the jumping around was fine and couldn't see what was different .
So as someone who has done movement plenty of times before without this odd issue, I'm just stumped.
I hate to have to keep asking for so much help because I don't want to feel like an idiot because I can't see the answer but I've been looking at it all for ages now and don't know what to do.
This is all my object's info : Player Parent's enemy collision on top , playable character code on bottom.
---------------------------------------------------------------------------------------------------------------------------------------------
if( place_meeting(x, bbox_bottom,enemyParent ) )
{
vspeed = -9;
hspeed = choose(-10,10);
}
if not place_empty(bbox_right,y) and place_meeting(bbox_right,y,enemyParent)
{
move_bounce_all(false);
hp -= enemyParent.atk - grd;
}
if not place_empty(bbox_left,y) and place_meeting(bbox_left,y,enemyParent)
{
move_bounce_all(false);
hp -= enemyParent.atk - grd;
}
-------------------------------------------------------------------------------------------------------------------------------------------
Information about object: wildWest
Sprite: westSPR
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent: playerParent
Children:
Mask: westMaskSPR
No Physics Object
Step Event:
call the inherited event of the parent object
execute code:
///attacking and movement
allow_player_movement();
allow_gravity();
limit_hp(max_hp);
enable_combos( ord("A"), ord("Q") );
//target 1 specific enemy
target = instance_nearest(x,y,enemyParent);
//enable the slash attack
if(comboCounter = 1)perform_slash(ord("A"),westSlashSPR,3,slashDmgOBJ);
//enable the 1st slash combo
if(comboCounter= 2)perform_slash(ord("A"),westSlashComboSPR,3,slashComboDmgOBJ);
//enable the final slash combo
if(comboCounter = 3)perform_slash(ord("A"),westSlashEndSPR,3,slashEndDmgOBJ);
//enable multislash
perform_multiSlash(fullSlashComboSPR);
//do a slash in the air
if(place_free(x, y+1))perform_slash(ord("P"),westAirSlashSPR,3,airSlashDmgOBJ);
//do a rising slash
perform_rising_slash(westJumpSlashSPR);
//enable the hammer attack
perform_hammer(westHammerSPR);
//enable the stab
perform_stab(westStabSPR);
//--------------------------------------------------------------------------------
//Stop the animation freeze after an attack so the dmg obj doesn't stay longer than 1 frame
if(atkFrameStall <= 0){ atkFrameStall = room_speed * 1; }
execute code:
///Set Regular Image Speed for Each Attack Animation
if(image_speed = 0)
{
switch(sprite_index)
{
case westSlashSPR : image_speed = slashRegImgSpd; break;
case westSlashComboSPR : image_speed = slashRegImgSpd; break;
case westSlashEndSPR : image_speed = slashRegImgSpd; break;
case westAirSlashSPR : image_speed = slashRegImgSpd; break;
case fullSlashComboSPR : image_speed = multiSlashRegImgSpd; break;
case westHammerSPR : image_speed = hammerRegImgSpd; break;
case westStabSPR : image_speed = stabRegImgSpd; break;
case westJumpSlashSPR : image_speed = risingSlashRegImgSpd; break;
}
}
Keyboard Event for <Left> Key:
execute code:
///perfect jump animation
if place_free(bbox_left,y) and (move_left) and not(move_down)
{
x -= move_spd;
direction = 180;
image_xscale = -1;
//adjust running for ground only
if not place_free(bbox_left,y+1)
{
sprite_index = westRunningSPR;
image_xscale = -1;
image_speed = .6;
}
//adjust image facing for attacks
switch(sprite_index)
{
case westJumpSPR : image_xscale = 1; break;
case westJumpSlashSPR : image_xscale = -1; break;
case westAirSlashSPR : image_xscale = -1; break;
}
}
//adjust jump animation while moving
if(sprite_index = westJumpSPR){image_speed = 0; image_index = 3;}
Keyboard Event for <Right> Key:
execute code:
if place_free(bbox_right,y) and (move_right) and not(move_down)
{
x += move_spd;
direction = 0;
image_xscale = 1;
//adjust running for ground only
if not place_free(bbox_right,y+1)
{
sprite_index = westRunningSPR;
image_xscale = 1;
image_speed = .6;
}
//adjust image facing for attacks
switch(sprite_index)
{
case westJumpSPR : image_xscale = -1; break;
case westJumpSlashSPR : image_xscale = 1; break;
case westAirSlashSPR : image_xscale = 1; break;
}
}
if(sprite_index = westJumpSPR){image_speed = 0; image_index = 3;}
Keyboard Event for <Down> Key:
execute code:
///Crouch
if not place_free(x,y+1) and (move_down)
{
sprite_index = westCrouchingSPR;
mask_index = westCrouchingSPR;
}
Key Press Event for <Ctrl> Key:
execute code:
//Jump
if not place_free(x,y+1)
{
vspeed = -jump_height;
sprite_index = westJumpSPR;
image_speed = .1;
}
Key Press Event for <Space> Key:
Restart the current room
Key Release Event for <Left> Key:
execute code:
///back to idle so the whole animation doesn't have to end
if(sprite_index = westRunningSPR) sprite_index = westSPR;
Key Release Event for <Right> Key:
execute code:
///back to idle so the whole animation doesn't have to end
if(sprite_index = westRunningSPR) sprite_index = westSPR;
Key Release Event for <Down> Key:
execute code:
mask_index = westMaskSPR;
sprite_index = westSPR;
----------------------------------------------------------------------------------------------------------------------------------------