Jump to content
A 2021 backup has been restored. Forums are closed and work in progress. Join our Discord server for more updates! ×
SoaH City Message Board

Sonic The Hedgehog - Reborn


Recommended Posts

You guys seriously need to chill. We already established that it has a lot of similarities to B/ATS, this is just flat out mean spirited.

LMAO! I got a warning for that?! Did you not read the comment? I dont think you did.

Please reread and really see what im actually saying.

  • Like 4
Link to comment
Share on other sites

LMAO! I got a warning for that?! Did you not read the comment? I dont think you did.

Please reread and really see what im actually saying.

Yea you did get a warning for that. And you need not push for anymore here because you're crossing the fucking line being a smartass with me, kid. Get a grip, quickly.

  • Like 1
Link to comment
Share on other sites

Yea you did get a warning for that. And you need not push for anymore here because you're crossing the fucking line being a smartass with me, kid. Get a grip, quickly.

Ok, no need to be totally rude. If you read it at all it you'd have realized that it was a sarcastic post, Complimenting the game in an indirect way. You know like satire. But calling me a smarta** with no basis to do so i feel is an abuse of modship powers sir, and that's where the joke stops being funny and becomes serious. I feel that I am in need of an apology from you sir. Just cause your an admin doesn't give you right to throw stones.

(you even deleted my comment I have a copy too to prove my point)

Edited by Pulse0
  • Like 3
Link to comment
Share on other sites

Ok, no need to be totally rude. If you read it at all it you'd have realized that it was a sarcastic post, Complimenting the game in an indirect way. You know like satire. But calling me a smarta** with no basis to do so i feel is an abuse of modship powers sir, and that's where the joke stops being funny and becomes serious. I feel that I am in need of an apology from you sir. Just cause your an admin doesn't give you right to trow stones.

 

You really need to quit pushing you luck because you're questioning my calls here. I'm not abusing my power, I'm telling you that was mean spirited. You're not a mod, you don't call shots at me, you don't sass me either. So you really need to do me and you a favor and get back on topic in a civilized and constructive manner. If you have that big of a beef with this dude's game, take to his PM inbox. You're not looking like an underdog here.

 

And sarcasm isn't easily read on the internet, fyi.

Link to comment
Share on other sites

Oh btw,i removed the Demo from the first post because i gonna upload (either today or tomorrow) a updated version of it with the missing boss track,a pause screen in the levels and some other small fixes (the special ring has been removed,text fixes,game restarts after the boss.)

Link to comment
Share on other sites

What is even going on in this thread? ._."


Um...if I have anything to say...I think Reborn is...decent so far. The physics really could use some reworking: Sonic controls fairly badly in the air. I also really think some of the level design needs to be reworked: Especially the ending section of act 2, where it feels clunky (partially thanks to the physics), boring, and just added on to extended the level time without having a forethought to the flow of said level design. I really do like that bg you made on this page too: it looks charming. I do have to say that I don't really like those thin, long clouds that are close to the mountains: they look weird and unfitting with the large, fluffier clouds.

However, I kind of do feel that the game's a bit /too/ similar to BtS and AtS in ways, especially the map background in zone 2 looking way to similar to the Map in Horizon Heights. I'm sure that once things get settled that we all can work together to improve the final product of the game to be fun and enjoyable.
 

Link to comment
Share on other sites

 

The "ruin" parts of the level shown seem taken straight from Horizon Heights

I guess you say that because of the bg,well you guys need to know that i added the bg to TEST it,it's not going to be a stage background,i actually made it for the Level Select Screen.

(So you can select levels like in Sonic Advance 2.)

 

And i totaly not try to make it a 'Lake Game',you will see that in later zones and sections of the game.

One example is that if you play Ruined Eggs Zone act 2 (Second Zone) the stage kinda gets puzzle styled,where you need to find switches and or switch to an different character to find a way out of the act.

Edited by DarkchaoX10
Link to comment
Share on other sites

So,i updated the demo just a little bit,also a new download link : D
Go check out the first page and post.

 

What is updated?

- You can now Pause the Game in the Zone. (with Enter)

- The Special Stage Ring in Act 1 has been Removed.

- Some Text fixes.

- The game restarts after you beat the boss.

- Some collision fixes (example:Sky Sanctuary part in Act 1.)

- Boss Music has been added : p

- Correct Shield Sprites has been added (i updated it a little bit.)

 

Btw,you can change the screen resolution with F4,and Restart the Game for watever reasons with F2 if you didn't knew that already.

Edited by DarkchaoX10
Link to comment
Share on other sites

I'm just gonna leave this one here...

 

wmqClTz.png

I'm just posting this to say that I don't exactly buy the fact that you (DCX100) created this before B/ATS. Also, I understand that this wasn't a ripoff, and that isn't a bad thing at all. ATS/BTS weren't made with all original ideas, and inspiration is ok.

could you like take that down_ your late we've been over this. Your doing that is just reheating the pot. dont you have anything constructive to say?

 

@DcX100 you mind adjusting the HUD too? i thinks kinda awquard having that "X" right under the HUD it doesn't mesh well, try looking at sonic colors or generations for help

Edited by Pulse0
Link to comment
Share on other sites

He's edited his post now to remove the argument. But what's done is done. AnOrdinarySonicFan has been suspended for two weeks. Anyone else?

 

Edit I am removing his suspension since he's a good member and fixed his post rather quickly. But I mean business. No more fighting in this topic or you will be banned.

Link to comment
Share on other sites

I know the current physics sucks,so could you guys maybe help me out just a little bit? those are the current values i have for most of Sonic's physics.

slope_decc_factor       =   0.14;           // slope deacceleration factor
        
crouch_down_timer       =   0;              // timer with stores how much time the char. is crouched
        
roll_decc_strong        =   0.07;           // deaccelerate while pressing the oppsite direction
roll_decc               =   0.03;           // deacceleration value while rolling
roll_decc_light         =   0.02;           // deaccelerate while pressing towards the same direction
        
roll_decc_factor_up     =   0.05;           // slope deacceleration factor while rolling and going up
roll_decc_factor_down   =   0.20;           // slope deacceleration factor while rolling and going down
        
spindash_accumulator    =   4;              // spindash amount accumulator
spindash_min_acc        =   8;              // spindash minium accumulator value
spindash_max_acc        =   16;             // spindash maxium accumulator value

y_speed                 =   0;              // y speed
max_y_speed             =   12;             // max y speed (only affects when going down)
y_acceleration          =   0.2;            // y acceleration / gravity
conversion_factor       =   0.8;            // speed conversion factor when landed on the ground
jump_strenght           =-6.60;             // the jump strenght    
skid_decc               = 0.23;             // deacceleration value while skidding 

top_x_speed             =   8;              // top x speed when running on flat ground
max_x_speed             =   12;             // max x speed
x_acceleration          =   0.046875;       // acceleration / deacceleration
slope_decc_factor       =   0.14;           // slope deacceleration factor     
slide_jump_force_x      = 4.2;
slide_jump_force_y      =  -6;
Edited by DarkchaoX10
Link to comment
Share on other sites

 

I know the current physics sucks,so could you guys maybe help me out just a little bit? those are the current values i have for most of Sonic's physics.

slope_decc_factor       =   0.14;           // slope deacceleration factor
        
crouch_down_timer       =   0;              // timer with stores how much time the char. is crouched
        
roll_decc_strong        =   0.07;           // deaccelerate while pressing the oppsite direction
roll_decc               =   0.03;           // deacceleration value while rolling
roll_decc_light         =   0.02;           // deaccelerate while pressing towards the same direction
        
roll_decc_factor_up     =   0.05;           // slope deacceleration factor while rolling and going up
roll_decc_factor_down   =   0.20;           // slope deacceleration factor while rolling and going down
        
spindash_accumulator    =   4;              // spindash amount accumulator
spindash_min_acc        =   8;              // spindash minium accumulator value
spindash_max_acc        =   16;             // spindash maxium accumulator value

y_speed                 =   0;              // y speed
max_y_speed             =   12;             // max y speed (only affects when going down)
y_acceleration          =   0.2;            // y acceleration / gravity
conversion_factor       =   0.8;            // speed conversion factor when landed on the ground
jump_strenght           =-6.60;             // the jump strenght    
skid_decc               = 0.23;             // deacceleration value while skidding 

top_x_speed             =   8;              // top x speed when running on flat ground
max_x_speed             =   12;             // max x speed
x_acceleration          =   0.046875;       // acceleration / deacceleration
slope_decc_factor       =   0.14;           // slope deacceleration factor     
slide_jump_force_x      = 4.2;
slide_jump_force_y      =  -6;

I don't really see anything wrong with the Create event for the rolling variables. All the numbers are correct except for that variable "roll_decc_strong". I'd change that to 0.125, if it has to do with braking while rolling.

 

The real problem lies somewhere in your Step event for the player object or the scripts for the "rolling" action.

Link to comment
Share on other sites

SuperBlitz,those are the Rolling codes:

// deacceleration on slopes.
        if (ground == true && relative_angle > 35 && relative_angle < 335)
        {
            if ( action == action_rolling )
            {
                // first check where the character is heading to
                if ( x_speed > 0 )  // the character is heading to the right
                {
                    if ( relative_angle < 180 ) 
                        // the character is going up a slope...
                        x_speed -=  sin(degtorad(relative_angle)) * roll_decc_factor_up;
                    else                
                        // the character is going down a slope
                        x_speed -=  sin(degtorad(relative_angle)) * roll_decc_factor_down;
                } else {            // the character is heading to the left
                    if ( relative_angle > 180 ) 
                        // the character is going up a slope...
                        x_speed -=  sin(degtorad(relative_angle)) * roll_decc_factor_up;
                    else                      
                        // the character is going down a slope
                        x_speed -=  sin(degtorad(relative_angle)) * roll_decc_factor_down;            
                }
            } else {
                x_speed -= sin(degtorad(relative_angle)) * slope_decc_factor;
            }
        }

//Other Stuff
if ( action == action_rolling )
        {
            // first check the direction of the movement
            if ( x_speed > 0 )
            {
                // deaccelerate depending on what are you pressing
                if (key_left)       x_speed -= roll_decc_strong;
                else if (key_right) x_speed -= roll_decc_light;
                else                x_speed -= roll_decc;
                
                // set to 0 the x_speed if it got lower than 0 (this is for preventing
                // decimal precission leftovers)
                if ( x_speed < 0 ) x_speed = 0;
            }
            else if ( x_speed < 0 )
            {
                // deaccelerate depending on what are you pressing
                if (key_left)       x_speed += roll_decc_light;
                else if (key_right) x_speed += roll_decc_strong;
                else                x_speed += roll_decc;
                
                // set to 0 the x_speed if it got greater than 0 (this is for preventing
                // decimal precission leftovers)
                if ( x_speed > 0 ) x_speed = 0;
            }
            
            // if the speed got 0, set back the normal action
            if ( x_speed == 0 ) action = action_normal;
            
            // if the character isn't on the ground anymore, change to jump
            // action
            if ( ground == false )
            {
                action = action_jumping;

                shield_usable = 1;
            }
        }
        else
        {
            // if the player is running, on the ground and pressed down, roll
            if ( action == action_normal && ground == true && abs(x_speed) >= 1 && key_down )
            {
                action = action_rolling;
                sound_play(sndRoll);
            }

Also,whats wrong with the jumping? some of you said that it isnt that good,i dont see a reason why...

Link to comment
Share on other sites

Try using the code from the Dash engine, I'm not sure if it'll alleviate the issue, but maybe we can find out if the Step event is an issue or not.

 

First off, include the following somewhere in your game, preferably in a startup room (if you have one). I've seen them being used frequently in the Dash engine, and they're used in the rolling code as well.

    for (i=0; i<360; i+=1) {
        global.CosTable[i] = cos(degtorad(i));
        global.SinTable[i] = sin(degtorad(i));
    }

This is what the Dash engine uses for rolling:

// ==== FUNCTION ====================================================================
// scrPlayerActionRolling()
// ==================================================================================
//  


    // Deceleration on input
    if (Speed < 0) {
        if (KeyRight)       Speed = min(0, Speed+RollingBraking);
        else                Speed = min(0, Speed+RollingDeceleration);
    } else if (Speed > 0) {
        if (KeyLeft)        Speed = max(0, Speed-RollingBraking);
        else                Speed = max(0, Speed-RollingDeceleration);
    } 

    // Deceleration based on angle
    if ( ((Speed > 0.0) && (ReferenceAngle < 180)) || ((Speed < 0.0) && (ReferenceAngle > 180)))
        Speed -= global.SinTable[ReferenceAngle]*RollingSlopeFactorUp;
    if ( ((Speed < 0.0) && (ReferenceAngle < 180)) || ((Speed > 0.0) && (ReferenceAngle > 180)))
        Speed -= global.SinTable[ReferenceAngle]*RollingSlopeFactorDown;
            
    // If player isn't on ground anymore, or pressed, switch to jump.
    if (!Ground) {
        Action                = consActionJumping;
        JumpVariable          = false;
        FlagsAllowCommonInput = true;
    }
    else if (KeyActionPressed) {
        scrPlayerMotionJumping();
        FlagsAllowCommonInput = false;
    }
    
    // If player definitely stopped, just change to normal.
    else if (Speed == 0.0) {
        Action                = consActionNormal;
        FlagsAllowCommonInput = true;
    }

Change the variables in the code so that it matches whatever variables your engine uses. (Btw, RollingBraking might refer to your variable roll_decc_strong.)

 

Also, you might want to add the statement if ( action == action_rolling) and its necessary brackets.

Link to comment
Share on other sites

Also physics guide values don't translate to engines Damizean made accurately, pretty sure he made the base for your engine too. So these are values I came up with testing my old version Time Twisted against Sonic 1.

 

    // ---- Character movement ----------------------------------------------------------
 
        // .... Movement values .........................................................
        Speed                   = 0;
        TopSpeed                = 6.8;
        Acceleration            = 0.055;
        Deceleration            = 0.04678;
        SlopeFactor             = .1;
 
        // .... Gravity values ..........................................................
        Gravity                 = 0;
        GravityForce            = 0.21875;
 
        // .... Action values ...........................................................
        JumpStrength            = -6.5;
        JumpReleaseStrength     = -4;
        JumpVariable            = true;
        
        SpringVariable          = false;
 
        LookUpTimer             = 100;
        LookUpShiftAmount       = -120;
 
        CrouchDownTimer         = 100;
        CrouchDownShiftAmount   = 120;
 
        SkidMiniumAmount        = 1.4;
        SkidRate                = 0.5;
 
        SpindashRev             = 0;
        SpindashRevCharge       = 1;
        SpindashRevLose         = 0.01;
        SpindashMinSpeed        = 8;
        SpindashMaxSpeed        = 12;
 
        RollingDeceleration     = 0.018;
        RollingBraking          = 0.125;
        RollingSlopeFactorUp    = 0.05 ;
        RollingSlopeFactorDown  = 0.3125;
Link to comment
Share on other sites

It seems to be a problem with the whole action/movement code.

I added the above and removed the other rolling codes,but sonic is keeping getting faster when walking on Slopes and Loops...

Heres the Whole Step Action/Movement script if you like to see it:

   
    // gameplay

        //--------------------- x movement ---------------------
       
        // only activate normal control while we're idle or jumping 
        if ( action == action_normal || action == action_jumping || action == action_sliding_jump || action == action_spring_jump || action == action_super_spring_jump 
         || ((shield == 3 || shield == 4) && action == action_shield) || action == action_corkscrew  || action == action_corkscrew_roll )
        {
            // acceleration
            if (key_left && x_speed > -top_x_speed)  x_speed -= x_acceleration;
            if (key_right && x_speed < top_x_speed)  x_speed += x_acceleration;

            // deacceleration while no key is pressed
            if (ground || action == action_corkscrew || action == action_corkscrew_roll)
            {
                if (!key_left && x_speed < 0)
                {
                    x_speed += x_acceleration;
                    // set to 0 when we full stop (this is performed due the floating point precision, otherwise some odd
                    // decimals will still remain in there)
                    if (x_speed > 0) x_speed  = 0;
                }

                if (!key_right && x_speed > 0)
                {
                    x_speed -= x_acceleration;
                    // set to 0 when we full stop (this is performed due the floating point precision, otherwise some odd
                    // decimals will still remain in there)            
                    if (x_speed < 0) x_speed = 0;
                }
            }

        }

        // deacceleration on slopes.
        if (ground == true && relative_angle > 35 && relative_angle < 335)
        {
            if ( action == action_rolling )
            {
                // first check where the character is heading to
                if ( x_speed > 0 )  // the character is heading to the right
                {
                    if ( relative_angle < 180 ) 
                        // the character is going up a slope...
                        x_speed -=  sin(degtorad(relative_angle)) * roll_decc_factor_up;
                    else                
                        // the character is going down a slope
                        x_speed -=  sin(degtorad(relative_angle)) * roll_decc_factor_down;
                } else {            // the character is heading to the left
                    if ( relative_angle > 180 ) 
                        // the character is going up a slope...
                        x_speed -=  sin(degtorad(relative_angle)) * roll_decc_factor_up;
                    else                      
                        // the character is going down a slope
                        x_speed -=  sin(degtorad(relative_angle)) * roll_decc_factor_down;            
                }
            } else {
                x_speed -= sin(degtorad(relative_angle)) * slope_decc_factor;
            }
        }

        // ---- Others ---------------------------------------------------------------------

        // fall if there isn't enough speed
        if (relative_angle > 80 && relative_angle < 280 && ground == true && abs(x_speed) < 3)
        {
            y_speed =   -sin(degtorad(relative_angle))*x_speed;
            x_speed =   cos(degtorad(relative_angle))*x_speed;
            ground  =   false;
        }

        // fall off the ground if the edges aren't colliding
        if (ground == true && angle != global.gravity_angle &&
            (player_collision_left_edge( x, y, angle ) == false || player_collision_right_edge( x, y, angle ) == false  ))
        {
            y_speed =   -sin(degtorad(relative_angle))*x_speed;
            x_speed =   cos(degtorad(relative_angle))*x_speed;
            ground  =   false;
        }

        // get new angle
        if (ground == true && player_collision_left_edge( x, y, angle ) && player_collision_right_edge( x, y, angle ))
            player_set_angle(player_get_angle( x, y, angle ));
        else
            player_set_angle(global.gravity_angle);
            
            // full stop when we're colliding a wall
        if (x_speed > 0 && player_collision_right(x,y,angle,maskBig))
        {
            x_speed = 0;
        }
        if (x_speed < 0 && player_collision_left(x,y,angle,maskBig))
        {
            x_speed = 0;
        }     

        
        //----------------------------------CAMERA---------------------------------
        if (x_speed > 0 && (player_collision_right(x,y,angle,maskBig) || x >= (global.camera_max_x-16)))
            x_speed = 0;
        if (x_speed < 0 && (player_collision_left(x,y,angle,maskBig) || x <= (global.camera_min_x+16)))
            x_speed = 0;

        
        //--------------------- y movement ---------------------
        
        if (ground)
        {
            y_speed = 0;

            // return to the normal state if the character was jumping
            if (action == action_jumping || action == action_sliding_jump || action == action_spring_jump|| action == action_super_spring_jump || action == action_swinging
            || ((shield == 2 || shield == 3) && action == action_shield)) action = action_normal;
            else if (shield == 4 && action == action_shield)
            {
                ground = false;
                y_speed =-6.78
                action = action_jumping;
            }
            else if (action == action_hurt)
            {
                x_speed = 0;
                action = action_normal;

            }

            // check if the player is really on the ground
            if (player_collision_bottom(x,y,angle,maskBig) == false)
            {
                ground = false;
                player_set_angle(global.gravity_angle);
            }
        }
        else
        {
            // Add gravity
            if (action != action_sliding && action != action_pipe && action != action_corkscrew && action != action_corkscrew_roll && action != action_super_spring_jump)
                y_speed += y_acceleration;

            // check if for some reason the player has landed
            if (y_speed >= 0 && player_collision_bottom(x,y,angle,maskBig) == true)
            {
                ground = true;
                // return to the normal state if the character was jumping
                if (action == action_jumping || action == action_sliding_jump || action == action_spring_jump
                || ((shield == 2 || shield == 3) && action == action_shield)) action = action_normal;
                else if (shield == 4 && action == action_shield)
                {
                    ground = false;
                    y_speed =-6.78;
                    action = action_jumping;
                }
                else if (action == action_hurt)
                {
                    x_speed = 0;
                    action = action_normal;
                }
            }

            // check if we're on the air but we collided with the ceiling
            if (y_speed < 0 && player_collision_top(x,y,angle,maskBig) == true)
                y_speed     = 0;
        }        
        
            if (y_speed >= 0 && player_collision_bottom(x,y,angle,maskMain) == true)
            {
            if (action == action_hurt){ x_speed = 0; }
            }
            
        //------------------------Falling------------------------
        if (action == action_falling){ground = false;}
        
        if (action == action_falling && (ground == true || y_speed == 0))
            {
            action = action_normal;
            }
        
        //--------------------- shield actions ---------------------
        
       //Air Attack
       
       if ( shield == 0 && invincibility == 0 && shield_usable && action == action_jumping && key_action_pressed )
        {
        invincibility = 3;
        invincibility_timer = 8;
        sound_play(sndAirAttack);
        shield_usable = false;
        }
        
        
        switch (shield)
        {
            case 2: // Fire Shield
                if ( shield_usable && action == action_jumping && key_action_pressed )
                {
                    if (animation_direction = 1) x_speed = 10;
                    else x_speed = -10;
                    y_speed = 0;

                    shield_usable = false;

                    action = action_shield;
                    sound_play(sndShieldFireUse);
                    

                }
            case 3: // Electric Shield
                if ( shield_usable && action == action_jumping && key_action_pressed )
                {

                    x_speed = x_speed/2
                    y_speed = -6

                    shield_usable = false;

                    action = action_shield;
                    sound_play(sndShieldElectricityUse);
                    

                }
            case 4: // Water Shield
                if ( shield_usable && action == action_jumping && key_action_pressed )
                {
                    x_speed = 0;
                    y_speed = 12;


                    action = action_shield;
                    animation = "waterbounce";
                    sound_play(sndShieldWaterUse);

                }
                break;
            default:
                if (action == action_shield) action = action_jumping;
            }


         if (global.CanMove == false){
         x_speed += 0.11;
         animation_direction = 1;
         }   
        
         //-----------------Alpha Max / Min------------------------------
         
         if (Alpha > 1)
             { 
         Alpha = 1; 
         }
         
         if (Alpha < 0 )
            {
         Alpha = 0;
         }
         
             
        //--------------------- normal actions ---------------------
        
        if (action == action_jumping)
        {
            if (!key_action) jump_timer = 13;
            if (y_speed < 0 && jump_timer <= 13 && key_action)
            {
                y_speed    += jump_strenght/(26);
                jump_timer += 1;
            }
        }
        else if ((ground == true || (action == action_corkscrew || action == action_corkscrew_roll)) && !player_collision_top(x, y-4, global.gravity_angle, maskBig ) && key_action_pressed && action != action_crouch_down && action != action_spindash && action !=action_peelout && action != action_lookup && action != action_sliding )
        {
            // while the player isn't crouching down or spindashing, jump
            y_speed     =   cos(degtorad(relative_angle))*(jump_strenght/2) - sin(degtorad(relative_angle))*x_speed;  // algorithm for a sonic-like
            x_speed     =   cos(degtorad(relative_angle))*x_speed + sin(degtorad(relative_angle))*jump_strenght;      // jump.

            ground      =   false;
            jump_timer  =   0;
            player_set_angle(global.gravity_angle);

            action      =   action_jumping;
            shield_usable = true;
            sound_play(sndJump);
            

        }

        //w
        if ( action == action_crouch_down )
        {
            crouch_down_timer += 1;
            
            // while the character is crouching down, if the player doesn't pressed the key anymore,
            // deactivate
            if ( !key_down && ground == true )
            {
                action            = action_normal;
                crouch_down_timer = 0;
            }
        } else {
            // crouch down. while the character is quiet, on the ground and pressing down, activate the
            // crouch down token.
            if (ground == true && x_speed == 0 && key_down && action == action_normal)
                action = action_crouch_down;

            crouch_down_timer = 0;
        }
        if ( action == action_lookup )
        {
            lookup_timer += 1;
            
            // while the character is looking up, if the player doesn't pressed the key anymore,
            // deactivate
            if ( !key_up && ground == true )
            {
                action  = action_normal;
                lookup_timer = 0;
            }
        } else {
            // look up. while the character is quiet, on the ground and pressing up, activate the
            // look up token.
            if (ground == true && x_speed == 0 && key_up && action == action_normal)
            {
                action = action_lookup;
            }        
        }
        
        //--------------------------Super Peel-Out---------------------------------------//

            if (action != action_rolling && action != action_spindash && key_up && key_action_pressed 
                && super_peel_out == 0 && ground==true && x_speed==0){
            action = action_peelout
            }
            if (action == action_peelout && super_peel_out < 11.5){
                super_peel_out += 0.2;
                }
            if (action == action_peelout && super_peel_out == 0.2){
            sound_play(sndSpinDashCharge);
            }
            
            if (action == action_peelout && !key_up && super_peel_out > 6){
            x_speed = animation_direction * super_peel_out;
            sound_play(sndSpinDashGo);
            super_peel_out = 0;
            }
            else
            if (action == action_peelout && !key_up && super_peel_out < 6){
            super_peel_out = 0;
            x_speed = 0;
            action = action_normal;
            }    
            
            if (ground==false){
            super_peel_out = 0;
            }  
            if (action == action_peelout && super_peel_out == 0){
            action = action_normal;
            } 
            if (action != action_peelout) { super_peel_out = 0; }
            
     if (action == action_win){ x_speed = 0; }
            
     //------------------------------Tube Rolling-------------------------------//
     
     if (action == action_pipe)
     {
     pipe_timer += 0.1;
     ground  = false;
     if ((pipe_type == 1) || (pipe_type == 3)){
     x_speed = pipe_mov_x;
     y_speed = pipe_mov_y;
        }
     }
     else
     pipe_timer = 0;
     
     if (pipe_timer = 0.2){
     if ((pipe_type == 1) || (pipe_type == 2)){
     sound_play(sndRoll)
        }
     }
     if (pipe_timer > 0.5){
     pipe_timer = 0.5
     }
     
     /*if (player_collision_main_object(x, y, objForcedTubeRoll)==true){
     Timer[0] += 0.1;
     }
     else
     Timer[0]=0;
     
     if (Timer[0] > 0.1){
     sound_play(sndRoll);
     }
     
      if (Timer[0] > 0.4){
     Timer = 0.4;
     }*/
     
     //------------------------------------Floating-------------------------------
     
     /*objHandle = player_collision_main_object(x,y,objFan);
     
     if (objHandle != noone){
     action = action_float;
     float_timer = 1;
     }
     
     if (action == action_float && float_timer = 1){
     y_speed = -1;
     ground = false;
     if (animation_direction = -1 && x_speed > -2){x_speed = -2}
     if (animation_direction =  1 && x_speed <  2){x_speed =  2}
     }
     
     if (objHandle == noone && float_timer = 1){
     float_timer = 0;
     action = action_normal;
     }*/
     
    //--------------------------------------Spindash------------------------------------//                                      
        if ( action == action_spindash )
        {   
            // if the player doesn't pressed down anymore, roll
            if ( !key_down )
            {
                // start rolling
                action = action_rolling;
                
                // set speed to the accumulator and set depending on the direction
                if ( animation_direction == 1 ) // facing to the right
                    x_speed = spindash_accumulator;
                else
                    x_speed = -spindash_accumulator;
                    sound_play(sndSpinDashGo);
                    sound_stop(sndSpinDashCharge);

                // disable shield usage
                shield_usable = false;

            }
            
            // if the player press again jump add power to the spindash accumulator,
            // otherwise, deaacelerate
            if ( key_action_pressed )
            {
                spindash_accumulator = min( spindash_accumulator +  0.7, spindash_max_acc );
                sound_play(sndSpinDashCharge);
            }
            else
                spindash_accumulator = max( spindash_accumulator - 0.01, spindash_min_acc );
        }
        else
        {
            // spindash. if the character is crouching down, and the player pressed the action key,
            // activate the spindash
            if ( action == action_crouch_down && key_action && can_dash )
            {
                action = action_spindash;    // set action to spindash
                spindash_accumulator = spindash_min_acc;    // reset the spindash accumulator
                sound_play(sndSpinDashCharge)
                
            }
        }
        
        if ( action == action_rolling )
        {
            // first check the direction of the movement
            if ( x_speed > 0 )
            {
                // deaccelerate depending on what are you pressing
                if (key_left)       x_speed -= roll_decc_strong;
                else if (key_right) x_speed -= roll_decc_light;
                else                x_speed -= roll_decc;
                
                // set to 0 the x_speed if it got lower than 0 (this is for preventing
                // decimal precission leftovers)
                if ( x_speed < 0 ) x_speed = 0;
            }
            else if ( x_speed < 0 )
            {
                // deaccelerate depending on what are you pressing
                if (key_left)       x_speed += roll_decc_light;
                else if (key_right) x_speed += roll_decc_strong;
                else                x_speed += roll_decc;
                
                // set to 0 the x_speed if it got greater than 0 (this is for preventing
                // decimal precission leftovers)
                if ( x_speed > 0 ) x_speed = 0;
            }
            
            // if the speed got 0, set back the normal action
            if ( x_speed == 0 ) action = action_normal;
            
            // if the character isn't on the ground anymore, change to jump
            // action
            if ( ground == false )
            {
                action = action_jumping;

                shield_usable = 1;
            }
        }
        else
        {
            // if the player is running, on the ground and pressed down, roll
            if ( action == action_normal && ground == true && abs(x_speed) >= 1 && key_down )
            {
                action = action_rolling;
                sound_play(sndRoll);
            }
        }

        if ( action == action_corkscrew || action == action_corkscrew_roll )
        {
            var corkscrewObject; corkscrewObject = player_collision_main_object(x, y, objCorkscrew);
            
            if ( abs(x_speed) < 4 )       action = action_normal;
            if (corkscrewObject == noone) action = action_normal;
            else
            {        
                var relativePosition, angleInCorkscrew;
                relativePosition = x - corkscrewObject.x;
                angleInCorkscrew = degtorad((relativePosition/384)*360);
                
                // Set position acording to relative position to corkscrew
                y = corkscrewObject.y + 26 + (1+cos(angleInCorkscrew))*(75*0.5);
                
                // Change animation frame depending on angle
                if ( action == action_corkscrew ) animation_frame = animation_corkscrew_start+abs((radtodeg(angleInCorkscrew)/360*11) mod 12);
            }
        }
        else if ( abs(x_speed) >= 4 && ground == true && player_collision_main_object(x, y, objCorkscrew) != noone )
        {
            // Set different actions based on current
            if ( action == action_rolling ) action = action_corkscrew_roll;
            else                            action = action_corkscrew;
            
            // Common stuff
            ground = false;
            player_set_angle(0);
        }
        
        
        
        if ( action == action_skid )
        {
            instance_create(x, y+12, objSkidDust);
            // first check the direction of the movement
            if ( x_speed > 0 )
            {
                // decelerate while pressing left
                if (key_left)       x_speed -= skid_decc;
                
                // finish skidding
                if ( x_speed < 0 || !key_left || !ground ) action = action_normal;
            }
            else if ( x_speed < 0 ) {
                // decelerate while pressing left
                if (key_right)      x_speed += skid_decc;
                
                // finish skidding
                if ( x_speed > 0 || !key_right || !ground ) action = action_normal;
            }
            if (x_speed == 0) action = action_normal;
        }
        else {
            if ( action == action_normal && ground == true)
            {
                if ((x_speed<-2) && key_right)
                {
                    action = action_skid;
                    sound_play(sndSkid);
                }
                if ((x_speed>2) && key_left)
                {
                    action = action_skid;
                    sound_play(sndSkid);
                }
            }
        }
        

Also,your code only would work like this for me:

if (x_speed < 0) {
        if (key_right)       x_speed = min(0, x_speed+roll_decc_strong);
        else                x_speed = min(0, x_speed+roll_decc);
    } else if (x_speed > 0) {
        if (key_left)        x_speed = max(0, x_speed-roll_decc_strong);
        else                x_speed = max(0, x_speed-roll_decc);
    } 

    // Deceleration based on angle
    if ( ((x_speed > 0.0) && (relative_angle < 180)) || ((x_speed < 0.0) && (relative_angle > 180)))
        x_speed -= global.SinTable[relative_angle]*roll_decc_factor_up;
    if ( ((x_speed < 0.0) && (relative_angle < 180)) || ((x_speed > 0.0) && (relative_angle > 180)))
        x_speed -= global.SinTable[relative_angle]*roll_decc_factor_down;
            
    // If player isn't on ground anymore, or pressed, switch to jump.
    if (!ground) {
        action                = action_jumping;
    }
    else if (key_action_pressed) {
        action = action_jumping;
        shield_usable = 1;
    }
    
    // If player definitely stopped, just change to normal.
    else if (x_speed == 0.0) {
        action                = action_normal;
        shield_usable = 1;
    }
Edited by DarkchaoX10
Link to comment
Share on other sites

A friend helped me and it seems that i got it to work now :D

thats the new code:

      // deacceleration on slopes.
        if (action == action_rolling){
            if ((relative_angle < 180 && sign(x_speed) == 1) || (relative_angle > 180 && sign(x_speed) == -1)){
               // the character is going up a slope...
               x_speed -=  sin(degtorad(relative_angle))*roll_decc_factor_up;
            }else{               
                // the character is going down a slope
                x_speed -=  sin(degtorad(relative_angle))*roll_decc_factor_down;
            }
        }else if(ground == true && relative_angle > 35 && relative_angle < 335){
            x_speed -= sin(degtorad(relative_angle)) * slope_decc_factor;
        }
  • Like 1
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...