Hello Guest, please login or register.
Did you miss your activation email?
Login with username, password and session length.

Pages: [1]   Go Down

Author Topic: Irritating bug - GM7  (Read 758 times)

0 Members and 1 Guest are viewing this topic.
Irritating bug - GM7
« on: February 08, 2010, 05:25:41 am »
  • *
  • Reputation: +12/-2
  • Offline Offline
  • Gender: Male
  • Posts: 4849
For some damn reason, if you are falling and holding either left or right, it is using the sprite "spr_red_fall".  Every other time you jump, fall etc or change direction, the changing of sprites works fine.  You can jump then fall, when you make contact with obj_solids, the animation properly goes to spr_red_idle if you are not pressing left or right.  It only messes up if you are pressing left or right then collide with obj_solids...

Here is my code broken down by events:

STEPS
Code: [Select]
if movable = 1
{
//SETTING ANY IDLE IMAGES OF THE PLAYER
    
    
    {
        if !(keyboard_check(vk_right)) && !(keyboard_check(vk_left))
        {
            if lastdir = 0
            {
                image_xscale = 1;
                //RED
                if shinobi = 1
                {
                    
                    
                        sprite_index = spr_red_idle;
                    
                }
                
            }      
        
            if lastdir = 1
            {
                image_xscale = -1;
                //RED
                if shinobi = 1
                {
                    
                        sprite_index = spr_red_idle;
                    
                }

            }
        
        }
    }
    
  
    
    
//MOVEMENT----------------------------------------------------------------------------------------------

    if keyboard_check(vk_right)  
    {
        image_xscale = 1;
        x = x + 1.5;
        
              
    }
    
    if keyboard_check(vk_left)
    {
        image_xscale = -1;
        x = x - 1.5;
        

    }
// END MOVEMENT------------------------------------------------------------------------------------------

//JUMPING AND FALLING  
    if (falling = 0)
    {
        
      

    //jumping
        if keyboard_check(ord('X')) && (jump > 0)
        {
            sprite_index = spr_red_jump;
            image_speed = 0;
            image_index = 0;
            jump = jump - 1;
            
            if jump > 0
            {
                y = y - 4;
                
            }
                      
        }
        
        else if jump = 0
        {
            jump = 20;
        }
        
        if jump > 15 && !keyboard_check(ord('X')) && !(jump = 20)
        {
            y = y - 4;
            jump -= 1;
        }
    
    }
    
    //falling
    if jump = 0 || (!keyboard_check(ord('X')) && jump < 16)
    {
        falling = 1;
    }
    
    
    if falling = 1
    {
        sprite_index = spr_red_fall;
        image_index = 0;
        image_speed = 0;
        y = y + 4;
        jump = 0;
        jumping = 0;
    }
    
    //falling collisions
    
    if !(place_meeting(x, y + 4, obj_solids)) &&  !(place_meeting(x,y + 4,obj_platforms)) && jump = 20
    {
        falling = 1;
    }
    
    if (place_meeting(x, y + 4,obj_solids))
    {
        falling = 0;
        jump = 20;
        
    }
    
    
    
}

RIGHT PRESSED(not checking, just the red arrow pressed - reverse for LEFT PRESSED)
Code: [Select]
if shinobi = 1
{

    if (jumping = 0) && (falling = 0)
    {
        image_index = 0;
        sprite_index = spr_red_walk;
        image_speed = .15;
    }  
    
    if (jumping = 1)
    {
        image_index = 0;
        sprite_index = spr_red_jump;
        image_speed = 0;
    }
    
    if (falling = 1)
    {
        image_index = 0;
        sprite_index = spr_red_fall;
        image_speed = 0;
    }
    
}

RELEASE RIGHT(reverse for RELEASE LEFT)
Code: [Select]
if !(keyboard_check(vk_left))
{
    lastdir = 0;
}


I've checked over and over and over, I must be overlooking something.
I've ran the game over and over in Debug mode and when this problem happens both jumping and falling equal 0.

EDIT: Nevermind, I found the problem...always happens after I post the problem on ZFGC, I figure it out >.>
« Last Edit: February 08, 2010, 05:29:16 am by Theforeshadower »
Logged
  • Super Fan Gamers!
Pages: [1]   Go Up

 


Contact Us | Legal | Advertise Here
2013 © ZFGC, All Rights Reserved



Page created in 0.034 seconds with 36 queries.