Open Surge Forum

A fun 2D retro platformer inspired by Sonic games and a game creation system

You are not logged in.

Announcement

Our community has moved to Discord! https://discord.gg/w8JqM7m

#1 2018-09-24 14:36:59

SynfigMaster91
Member
Registered: 2017-10-10
Posts: 144

Help to fix my Speedy character [SOLVED]

Hi, guys!

I'm having new problems.

Following Alex's hint to remove the .spindash_controller from my character Speedy, I started to experience certain problems. When I press the space bar to make Speedy spindash, he won't change to the spinning animation.

Also, when he's underwater, when I make him swim when he's standing at right, he turns to left as he swims.

Here's a video proving it:
https://drive.google.com/open?id=1fDBRP … VMow9hu9T8

If someone can help to fix my character I will appreciate it.

Here are the scripts and sprites:
https://drive.google.com/open?id=1v_k-_ … vjF5UrHUCu

Last edited by SynfigMaster91 (2018-09-26 15:15:40)

Offline

#2 2018-09-24 14:46:02

Alexandre
Administrator
From: Brazil
Registered: 2009-01-27
Posts: 3,279
Website

Re: Help to fix my Speedy character [SOLVED]

Hi SynfigMaster91,

Let's see the spindash first.

Did you update the character file?
http://opensnc.sourceforge.net/wiki/ind … Characters

You have to update everything accordingly, including the charging animation.

Example wrote:

    animations
    {
        sprite_name                 "SD_SURGE"
        stopped                     0
        walking                     1
        running                     2
        jumping                     3
        springing                   13
        rolling                     3
        charging                    6
        pushing                     14
        gettinghit                  11
        dead                        8
        braking                     7
        ledge                       10
        drowned                     9
        breathing                   12
        waiting                     15
        ducking                     4
        lookingup                   5
        winning                     17
        ceiling                     16
    }

also include the sounds and the abilities

Offline

#3 2018-09-24 15:03:34

SynfigMaster91
Member
Registered: 2017-10-10
Posts: 144

Re: Help to fix my Speedy character [SOLVED]

Alexandre wrote:

Hi SynfigMaster91,

Let's see the spindash first.

Did you update the character file?
http://opensnc.sourceforge.net/wiki/ind … Characters

You have to update everything accordingly, including the charging animation.

Example wrote:

    animations
    {
        sprite_name                 "SD_SURGE"
        stopped                     0
        walking                     1
        running                     2
        jumping                     3
        springing                   13
        rolling                     3
        charging                    6
        pushing                     14
        gettinghit                  11
        dead                        8
        braking                     7
        ledge                       10
        drowned                     9
        breathing                   12
        waiting                     15
        ducking                     4
        lookingup                   5
        winning                     17
        ceiling                     16
    }

also include the sounds and the abilities

Ok, now it changes the sprite, but how do I add the sounds?

Offline

#4 2018-09-24 15:05:26

SynfigMaster91
Member
Registered: 2017-10-10
Posts: 144

Re: Help to fix my Speedy character [SOLVED]

SynfigMaster91 wrote:
Alexandre wrote:

Hi SynfigMaster91,

Let's see the spindash first.

Did you update the character file?
http://opensnc.sourceforge.net/wiki/ind … Characters

You have to update everything accordingly, including the charging animation.

Example wrote:

    animations
    {
        sprite_name                 "SD_SURGE"
        stopped                     0
        walking                     1
        running                     2
        jumping                     3
        springing                   13
        rolling                     3
        charging                    6
        pushing                     14
        gettinghit                  11
        dead                        8
        braking                     7
        ledge                       10
        drowned                     9
        breathing                   12
        waiting                     15
        ducking                     4
        lookingup                   5
        winning                     17
        ceiling                     16
    }

also include the sounds and the abilities

Ok, now it changes the sprite, but how do I add the sounds?

Never mind, I fixed that. Now, about the swimming problem, which consists on Speedy looking at right and jumping and pressing the swimming button, which makes Speedy looking at left when he swims. How can it be fixed?

Offline

#5 2018-09-24 15:42:53

Alexandre
Administrator
From: Brazil
Registered: 2009-01-27
Posts: 3,279
Website

Re: Help to fix my Speedy character [SOLVED]

What causes this behavior is a command called look_at_walking_direction. Let's try some other approach.

Try to change your swimming state to this:

    state "swimming"
    {
        hide

        // got hit?
        on_player_gethit "getting hit underwater"

        // killed?
        on_player_death "destroy"

        // landed on the floor?
        attach_to_player 0 -1
        if "obstacle_exists(0,32) and player_yspeed() > 0" "underwater but not swimming"

        // play the swimming animation
        springfy_player
        set_player_animation SD_PIXEL 0
        set_animation SD_SPEEDY 21
        set_absolute_position xpos()-player_direction() ypos()
        look_at_player
        show
        on_button_pressed "fire6" "swim"

        // got off water?
        on_player_underwater "swimming"
        hide
        change_state "out of water"
    }

Offline

#6 2018-09-25 12:21:54

SynfigMaster91
Member
Registered: 2017-10-10
Posts: 144

Re: Help to fix my Speedy character [SOLVED]

Alexandre wrote:

What causes this behavior is a command called look_at_walking_direction. Let's try some other approach.

Try to change your swimming state to this:

    state "swimming"
    {
        hide

        // got hit?
        on_player_gethit "getting hit underwater"

        // killed?
        on_player_death "destroy"

        // landed on the floor?
        attach_to_player 0 -1
        if "obstacle_exists(0,32) and player_yspeed() > 0" "underwater but not swimming"

        // play the swimming animation
        springfy_player
        set_player_animation SD_PIXEL 0
        set_animation SD_SPEEDY 21
        set_absolute_position xpos()-player_direction() ypos()
        look_at_player
        show
        on_button_pressed "fire6" "swim"

        // got off water?
        on_player_underwater "swimming"
        hide
        change_state "out of water"
    }

I tried but it still has the same result: when Speedy looks at right, jumps, and swims, he turns to left but when he lands he turns to right.

Offline

#7 2018-09-25 14:23:29

Alexandre
Administrator
From: Brazil
Registered: 2009-01-27
Posts: 3,279
Website

Re: Help to fix my Speedy character [SOLVED]

Can you show us the files you're using, as well as the results you're getting?

I tried in my setup and it worked fine. Also tested on 18.830-dev.

Offline

#8 2018-09-25 15:05:32

SynfigMaster91
Member
Registered: 2017-10-10
Posts: 144

Re: Help to fix my Speedy character [SOLVED]

Alexandre wrote:

Can you show us the files you're using, as well as the results you're getting?

I tried in my setup and it worked fine. Also tested on 18.830-dev.

The .obj file:

object ".speedy_companion"
{
    requires 0.2.0
    always_active

    state "main"
    {
        create_child ".speedy_spindash_controller"
        create_child ".speedy_nolightwalk_controller"
        create_child ".speedy_swim"
        destroy
    }
}


object ".speedy_spindash_controller"
{
    requires 0.2.0
    always_active

    state "main"
    {
        hide
        observe_player "speedy"
        change_state "stand by"
        weak_player
    }

    state "stand by"
    {
        on_player_duck "duck"
    }

    state "duck"
    {
        let "$p = 0"
        on_button_pressed "fire1" "charge"
        on_player_duck "duck"
        change_state "stand by"
    }

    state "charge"
    {
        set_player_animation "SD_speedy" "6"
        strong_player
        springfy_player // so that the camera won't go down, since the player is ducking
        disable_player_movement
        play_sample "charge"
        let "$p = min($p+2, 8)"
        change_state "hold"
    }

    state "hold"
    {
        //textout menu.small 0 0 $p
        set_player_animation "SD_speedy" "6"
        let "$p -= 0.234 * floor(8*$p) * dt()"

        // check if there's a platform underneath the player
        attach_to_player 0 20
        unless "obstacle_exists(0,0)" "cancel"

        // create cool particles
        let "$_pixelparticle_anim = 1 + random(3)"
        let "$_pixelparticle_xvel = -player_direction() * (120 + random(60))"
        let "$_pixelparticle_yvel = -60 - random(120)"
        create_child .pixelparticle -player_direction()*7 -2
        let "$_pixelparticle_anim = 1 + random(3)"
        let "$_pixelparticle_xvel = -player_direction() * (120 + random(60))"
        let "$_pixelparticle_yvel = -60 - random(120)"
        create_child .pixelparticle -player_direction()*7 -2
        let "$_pixelparticle_anim = 1 + random(3)"
        let "$_pixelparticle_xvel = -player_direction() * (120 + random(60))"
        let "$_pixelparticle_yvel = -60 - random(120)"
        create_child .pixelparticle -player_direction()*7 -2

        // check if the user wants to charge more, or if we can release the player
        on_button_pressed "fire1" "charge"
        on_button_down "down" "hold"
        change_state "release"
    }

    state "cancel"
    {
        enable_player_movement
        weak_player
        change_state "stand by"
    }

    state "release"
    {
        play_sample "release"
        enable_player_movement
        weak_player
        set_player_xspeed "(480 + 30 * floor($p)) * player_direction()"
        roll_player
        change_state "stand by"
    }
}

object ".speedy_nolightwalk_controller" // his lighting sneakers can't shine when in the air
{
    requires 0.2.0
    always_active

    state "main"
    {
        hide
        observe_player "speedy"
        change_state "stand by"
        weak_player
    }

    state "stand by"
    {
        on_player_in_the_air "air"
    }

    state "air"
    {
        on_player_walk "walking in the air"
        on_player_run "running in the air"
        on_player_brake "braking in the air"
        on_player_in_the_air "air"
        change_state "stand by"
    }

    state "walking in the air"
    {
        on_player_spring "stand by"
        on_player_jump "stand by"
        on_player_gethit "stand by"
        on_player_death "stand by"

        set_player_animation "SD_speedy" 18
        on_player_in_the_air "walking in the air"
        change_state "stand by"
    }

    state "running in the air"
    {
        on_player_spring "stand by"
        on_player_jump "stand by"
        on_player_gethit "stand by"
        on_player_death "stand by"

        set_player_animation "SD_speedy" 19
        on_player_in_the_air "running in the air"
        change_state "stand by"
    }

    state "braking in the air"
    {
        on_player_spring "stand by"
        on_player_jump "stand by"
        on_player_gethit "stand by"
        on_player_death "stand by"

        set_player_animation "SD_speedy" 20
        on_player_in_the_air "braking in the air"
        change_state "stand by"
    }
}

object ".speedy_swim"
{
    requires 0.2.0
    always_active

    state "main"
    {
        observe_player "Speedy"
        hide
        change_state "out of water"
    }
    
    state "out of water"
    {
        on_player_underwater "dive"
    }
    
    state "dive"
    {
        on_button_pressed "fire6" "swimming"
    }

    state "swimming"
    {
        hide

        // got hit?
        on_player_gethit "getting hit underwater"

        // killed?
        on_player_death "destroy"

        // landed on the floor?
        attach_to_player 0 -1
        if "obstacle_exists(0,32) and player_yspeed() > 0" "underwater but not swimming"

        // play the swimming animation
        springfy_player
        set_player_animation SD_PIXEL 0
        set_animation SD_SPEEDY 21
        set_absolute_position xpos()-player_direction() ypos()
        look_at_player
        show
        on_button_pressed "fire6" "swim"

        // got off water?
        on_player_underwater "swimming"
        hide
        change_state "out of water"
    }

    state "swim"
    {
        springfy_player
        attach_to_player 0 18
        set_player_animation SD_PIXEL 0
        set_player_yspeed -90
        change_state "swimming"
    }

    state "underwater but not swimming"
    {
        on_player_jump "dive"
        on_player_underwater "underwater but not swimming"
        change_state "out of water"
    }

    state "getting hit underwater"
    {
        // wait until the getting hit animation stops
        on_player_gethit "getting hit underwater"
        change_state "underwater but not swimming"
    }

    state "destroy"
    {
        destroy
    }

}

The .spr file:

// Speedy
sprite SD_SPEEDY
{
    source_file     images/speedy.png
    source_rect     0 0 512 320
    frame_size      64 64
    hot_spot        32 63

    // stopped
    animation 0
    {
        repeat      TRUE
        fps         8
        data        0
    }

    // walking
    animation 1
    {
        repeat      TRUE
        fps         16
        data        1 2 3 4 5 4 3 2
    }

    // running
    animation 2
    {
        repeat      TRUE
        fps         15
        data        6 7 8 9 10 9 8 7   
    }

    // jumping / rolling
    animation 3
    {
        repeat      TRUE
        fps         16
        data        11 12 13 14
    }

    // ducking
    animation 4
    {
        repeat      FALSE
        fps         12
        data        19
    }

    // looking up
    animation 5
    {
        repeat      FALSE
        fps         8
        data        16 
    }

    // charging
    animation 6
    {
        repeat      TRUE
        fps         32
        data        11 12 13 14
    }

    // braking
    animation 7
    {
        repeat      FALSE
        fps         8
        data        15
    }

    // dead
    animation 8
    {
        repeat      FALSE
        fps         8
        data        18
    }

    // drowned
    animation 9
    {
        repeat      FALSE
        fps         8
        data        18
    }

    // ledge
    animation 10
    {
        repeat      TRUE
        fps         5
        data        23 24
    }

    // getting hit
    animation 11
    {
        repeat      FALSE
        fps         8
        data        20
    }

    // breathing
    animation 12
    {
        repeat      FALSE
        fps         8
        data        21
    }

    // springing
    animation 13
    {
        repeat      TRUE
        fps         8
        data        17
    }

    // pushing
    animation 14
    {
        repeat      TRUE
        fps         8
        data        27 28
    }

    // waiting
    animation 15
    {
        repeat      TRUE
        fps         6
        data        25 26
    }

    // ceiling (being carried)
    animation 16
    {
        repeat      TRUE
        fps         8
        data        22
    }

    // winning (victory)
    animation 17
    {
        repeat      FALSE
        fps         8
        data        29
    }

    // walking (no lights in the shoes)
    animation 18
    {
        repeat      TRUE
        fps         16
        data        1 2 3 4 5 4 3 2
    }

    // running (no lights in the shoes)
    animation 19
    {
        repeat      TRUE
        fps         15
        data        6 7 8 9 10 9 8 7   
    }

    // braking (no lights in the shoes)
    animation 20
    {
        repeat      FALSE
        fps         8
        data        15
    }
    
    // swim
    animation 21
    {
        repeat      TRUE
        fps         8
        data        30 31 30 32
    }
}

The .chr file:

character "speedy"
{
    companion_object                ".speedy_companion"
   
    multipliers
    {
        acceleration                1.0
        deceleration                1.0
        topspeed                    1.0
        jump                        1.0
        jumprel                     1.0
        gravity                     1.0
        rollthreshold               1.0
        brakingthreshold            1.0
        slope                       1.0
        rolluphillslope             1.0
        rolldownhillslope           1.0
    }
   
    animations
    {
        sprite_name                 "SD_speedy"
        stopped                     0
        walking                     1
        running                     2
        jumping                     3
        springing                   13
        rolling                     3
        pushing                     14
        gettinghit                  11
        dead                        8
        braking                     7
        ledge                       10
        drowned                     9
        breathing                   12
        waiting                     15
        ducking                     4
        lookingup                   5
        winning                     17
        ceiling                     16
    }
   
    samples
    {
        jump                        "samples/jump.wav"
        roll                        "samples/roll.wav"
        death                       "samples/death.wav"
        brake                       "samples/brake.wav"
    }
}

Link to a video about my results:
https://drive.google.com/open?id=1XlhmB … vS4cpvjKty

Also it seems when Speedy is spindashing, and after going up and landing on the floor, he's still rolling unless you jump.

Offline

#9 2018-09-25 16:08:17

Alexandre
Administrator
From: Brazil
Registered: 2009-01-27
Posts: 3,279
Website

Re: Help to fix my Speedy character [SOLVED]

Hey Alvaro,

The files are outdated.

I'd suggest you write a new .chr from scratch, according to the documentation.

Also, please remove the legacy spindash controller from your script, so the engine can update this move. Try to replace your .obj by my own.

Here's my .obj script: (scripts/legacy/speedy.obj)

object ".speedy_companion"
{
    requires 0.2.0
    always_active

    state "main"
    {
        create_child ".speedy_swim"
        destroy
    }
}

object ".speedy_swim"
{
    requires 0.2.0
    always_active

    state "main"
    {
        observe_player "Speedy"
        hide
        change_state "out of water"
    }
    
    state "out of water"
    {
        on_player_underwater "dive"
    }
    
    state "dive"
    {
        on_button_pressed "fire6" "swimming"
    }

    state "swimming"
    {
        hide

        // got hit?
        on_player_gethit "getting hit underwater"

        // killed?
        on_player_death "destroy"

        // landed on the floor?
        attach_to_player 0 -1
        if "obstacle_exists(0,32) and player_yspeed() > 0" "underwater but not swimming"

        // play the swimming animation
        springfy_player
        set_player_animation SD_PIXEL 0
        set_animation SD_SPEEDY 21
        set_absolute_position xpos()-player_direction() ypos()
        look_at_player
        show
        on_button_pressed "fire6" "swim"

        // got off water?
        on_player_underwater "swimming"
        hide
        change_state "out of water"
    }

    state "swim"
    {
        springfy_player
        attach_to_player 0 0
        set_player_animation SD_PIXEL 0
        set_player_yspeed -90
        change_state "swimming"
    }

    state "underwater but not swimming"
    {
        on_player_jump "dive"
        on_player_underwater "underwater but not swimming"
        change_state "out of water"
    }

    state "getting hit underwater"
    {
        // wait until the getting hit animation stops
        on_player_gethit "getting hit underwater"
        change_state "underwater but not swimming"
    }

    state "destroy"
    {
        destroy
    }

}

I wonder if there are more outdated files?

Offline

#10 2018-09-26 15:15:22

SynfigMaster91
Member
Registered: 2017-10-10
Posts: 144

Re: Help to fix my Speedy character [SOLVED]

Alexandre wrote:

Hey Alvaro,

The files are outdated.

I'd suggest you write a new .chr from scratch, according to the documentation.

Also, please remove the legacy spindash controller from your script, so the engine can update this move. Try to replace your .obj by my own.

Here's my .obj script: (scripts/legacy/speedy.obj)

object ".speedy_companion"
{
    requires 0.2.0
    always_active

    state "main"
    {
        create_child ".speedy_swim"
        destroy
    }
}

object ".speedy_swim"
{
    requires 0.2.0
    always_active

    state "main"
    {
        observe_player "Speedy"
        hide
        change_state "out of water"
    }
    
    state "out of water"
    {
        on_player_underwater "dive"
    }
    
    state "dive"
    {
        on_button_pressed "fire6" "swimming"
    }

    state "swimming"
    {
        hide

        // got hit?
        on_player_gethit "getting hit underwater"

        // killed?
        on_player_death "destroy"

        // landed on the floor?
        attach_to_player 0 -1
        if "obstacle_exists(0,32) and player_yspeed() > 0" "underwater but not swimming"

        // play the swimming animation
        springfy_player
        set_player_animation SD_PIXEL 0
        set_animation SD_SPEEDY 21
        set_absolute_position xpos()-player_direction() ypos()
        look_at_player
        show
        on_button_pressed "fire6" "swim"

        // got off water?
        on_player_underwater "swimming"
        hide
        change_state "out of water"
    }

    state "swim"
    {
        springfy_player
        attach_to_player 0 0
        set_player_animation SD_PIXEL 0
        set_player_yspeed -90
        change_state "swimming"
    }

    state "underwater but not swimming"
    {
        on_player_jump "dive"
        on_player_underwater "underwater but not swimming"
        change_state "out of water"
    }

    state "getting hit underwater"
    {
        // wait until the getting hit animation stops
        on_player_gethit "getting hit underwater"
        change_state "underwater but not swimming"
    }

    state "destroy"
    {
        destroy
    }

}

I wonder if there are more outdated files?

Thanks, Alex! smile This problem was solved.

Offline

Board footer

Powered by FluxBB  hosted by tuxfamily.org