Topic: How to add a new sprite/object to "OpenSonic"?

Hello.

I am completely new here so forgive me if I sound completely stupid.

I have recently been searching this forum regarding how to add a new sprite/object to the game "OpenSonic" ver. 0.1.4, but there appears to be no suitable answer.

The objects that I wish to add to the game are within this link:
http://www.sonicgalaxy.net/img/sprites/ms/edu/misc.png

Is there any possible way to perform this procedure?

Many thanks for taking the time to answer this question smile

Kind regards,
Harmeet Heer

Re: How to add a new sprite/object to "OpenSonic"?

I could help you, but the link you posted is broken.
I can't access what you're trying to do, but i might be able to offer you some insight.
But i'm not really good with 0.1.4, so for most of what i'm going to say requires the Open Surge Engine.
But scripting sprites is something that is not my strong suit, but i know how to script objects though.
But still i recommend getting the Open Surge engine, you might have a better chance with that.
You can also ask other members for help as well.

---
To script sprites, you have to either make a whole new file, or just use one you already have.
But an easy way, but one that may not work all the time, take the sprite and paste it over the current sprite in the PNG image.
But that's an easy way, ask someone else for more of a better description.
Did i help some?

Last edited by aronthehedgehog (2015-10-27 14:16:51)

www.facebook.com/24XFSAL  Hasn't been updated anytime recently, don't bother.
I'm on SoundCloud: https://soundcloud.com/rain-new-holy - I plan to upload one soon.
Name change from 24XFSAL coming soon. Currently studying for Information Technology and Game development. (Also studying game theory in spare time.)

Re: How to add a new sprite/object to "OpenSonic"?

Hello.

I would use "Open Surge" but I am required to use "Open Sonic" ver. 0.1.4 for my game development course. Additionally, that particular game engine doesn't contain Sonic, Tails and Knuckles as the main players, and I am currently striving to create an educational Sonic game.

So far, I have saved the sprite sheet in the "images" folder within the "Open Sonic" directory, and it generated a ".spr" file extension in the "sprites" folder. Afterwards, I have executed the application and entered into "Level Editor" mode, but I cannot find the objects contained within the sprite sheet, by navigating through the mouse wheel and pressing "Ctrl" at the same time.

Does anyone else have any further suggestions on how to import the objects from the sheet into "Level Editor"? I am currently in the process of creating my own level, and I would greatly appreciate it if anyone can offer me additional support smile

Here is the sprite sheet and the sprites/objects I am trying to add:

http://www.sonicgalaxy.net/img/sprites/ms/edu/misc.png

Thank you.

Kind regards,
Harmeet Heer

Re: How to add a new sprite/object to "OpenSonic"?

Open Surge is more appropriate.
There you can create new characters, objects, special and others.
Open Sonic is a bit outdated wink

Re: How to add a new sprite/object to "OpenSonic"?

I see. It is possible to add Sonic, Tails and Knuckles as the main players to "Open Surge"?

Re: How to add a new sprite/object to "OpenSonic"?

Yes, i've done that before, but for the advanced features of the engine, you might have to script them. (E.g. Tails' Flight, Knuckles' Gliding etc.) But other than that, You can use either Surge's script as a template, or use another character.
And also note that each character uses an object script, and a CHR script. Object controls what they do, CHR controls their speed and other stuff. (Jump power etc.)

---

I could help you if you need it, other than that most other members could help.

Last edited by aronthehedgehog (2015-10-27 18:14:17)

www.facebook.com/24XFSAL  Hasn't been updated anytime recently, don't bother.
I'm on SoundCloud: https://soundcloud.com/rain-new-holy - I plan to upload one soon.
Name change from 24XFSAL coming soon. Currently studying for Information Technology and Game development. (Also studying game theory in spare time.)

Re: How to add a new sprite/object to "OpenSonic"?

Is it possible to walk me through the process of adding Sonic, Tails and Knuckles as the main characters in "Open Surge" ver. 0.2.0? Many thanks.

Re: How to add a new sprite/object to "OpenSonic"?

*Note: This only works with Open Surge Engine (0.2.0)
This is an easy way, but i'll make a video later.
Ok hold on...
I have the file for sonic. i'll explain how to use it, just give me a while to upload it. (My computer i'm working on for school doesn't allow to open OBJ files for some reason, so it'll take me a while.)
---
And a question, do you want sonic to boost or something?
And i also will upload the CHR file too.

Ok so to add a new character in Open Surge Engine, you have to make the object for it first.
Either copy an object and paste it with a new name (rename etc.)
Then open it (you can open it with word or wordpad), then paste this code into it.

// ---------------------------------------------------------------------------
// Open Surge Engine
// http://opensnc.sourceforge.net
//
// File:   default_companions/sonic.inc
// Desc:   Sonic Companion
// Author: rain
// Date:   1/1/13, 12/15/13, 11/26/14
// ---------------------------------------------------------------------------

object ".sonic_companion" 
{
    requires 0.2.0
    always_active

    state "main"
    {
        create_child ".sonic_spindash_controller"
        create_child ".sonic_nolightwalk_controller"
        destroy
    }
}


object ".sonic_spindash_controller"
{
    requires 0.2.0
    always_active

    state "main"
    {
        hide
        observe_player "Sonic"
        change_state "stand by"
    }

    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_SONIC" "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_SONIC" "6"
        let "$p -= 0.234 * floor(8*$p) * dt()"

        // check if there's a platform underneath the player
        attach_to_player 0 20
        unless "brick_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 ".sonic_nolightwalk_controller" // his lighting sneakers can't shine when in the air
{
    requires 0.2.0
    always_active

    state "main"
    {
        hide
        observe_player "Sonic"
        change_state "stand by"
    }

    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_SONIC" 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_SONIC" 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_SONIC" 20
        on_player_in_the_air "braking in the air"
        change_state "stand by"
    }
}

Then after you make the object, (don't launch the game yet) make a new CHR file, they should be located in the "character folder.". Copy a blank one (known as none),  then paste this into there.

// ---------------------------------------------------------------------------
// Open Surge Engine
// http://opensnc.sourceforge.net
//
// File:   characters/sonic.chr
// Desc:   character definitions: None. 
//         another character
// Author: rain
// Date:   2011-02-08
// ---------------------------------------------------------------------------

character "Sonic"
{
    companion_object                ".sonic_companion"
    
    multipliers
    {
        acceleration                1.0
        deceleration                1.0
        topspeed                    1.5
        jump                        1.0
        jumprel                     1.0
        gravity                     1.0
        rollthreshold               1.5
        brakingthreshold            1.0
        slope                       1.0
        rolluphillslope             2.0
        rolldownhillslope           2.0
    }
    
    animations
    {
        sprite_name                 "SD_sonic"
        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                     24
        ceiling                     25
    }
    
    samples
    {
        jump                        "samples/jump.wav"
        roll                        "samples/roll.wav"
        death                       "samples/death.wav"
        brake                       "samples/brake.wav"
    }
}

This would also require a Sprite file, copy that one from the 0.1.4 engine, and paste that into the "sprites" folder.
And also i'd recommend to get that player.png file from the 0.1.4 engine (located in the images), paste that into the Images folder.
That should solve the problem, then that should work and the character might work after that.
To test this, you should open a "Level" file, any one will do and put in on that line of code where it says "players".
type next to the current player, "sonic" in there. Then launch the game and enter the options menu. (simply tap enter on the title screen from what i remember.)
Then go to level select, and choose the level that it's in.

And if this doesn't help, i'll make a tutorial video if you'd like. Then i can explain more things in detail.

I'd also recommend that you'd study these scripts, and also study the other scripts within the engine. And if you don't what to do, ask the members here in this website. I won't know all the answers to every problem, so even reach out to other people.

Last edited by aronthehedgehog (2015-10-28 15:01:15)

www.facebook.com/24XFSAL  Hasn't been updated anytime recently, don't bother.
I'm on SoundCloud: https://soundcloud.com/rain-new-holy - I plan to upload one soon.
Name change from 24XFSAL coming soon. Currently studying for Information Technology and Game development. (Also studying game theory in spare time.)

Re: How to add a new sprite/object to "OpenSonic"?

Dear Harmeet Heer,

Welcome to the forums.

As aron and Matheus have said, using Open Surge 0.2.0 is more appropriate. However, if you are absolutely required to use 0.1.4, then you can script new objects and add them to the game using the Level Editor, though their functionality will be more limited.

We suggest you start reading Introduction to objects. Then, you can play around with some Case studies such as Case study #1: creating a simple enemy.

Good luck! wink

Re: How to add a new sprite/object to "OpenSonic"?

Thank you 'Alexandre', 'aron' and 'Matheus' for your meaningful contributions! smile

The case studies in which you have provided to me have enabled me to continue in developing an educational Sonic game. I will be sure to distribute it in forums, so that I all of you can see it, and maybe test it to your hearts content!

Again, many thanks for your assistance! smile

Kindest regards,
Harmeet Heer

Re: How to add a new sprite/object to "OpenSonic"?

If it helps i will assist, but know that i may not know all of the answers though.

www.facebook.com/24XFSAL  Hasn't been updated anytime recently, don't bother.
I'm on SoundCloud: https://soundcloud.com/rain-new-holy - I plan to upload one soon.
Name change from 24XFSAL coming soon. Currently studying for Information Technology and Game development. (Also studying game theory in spare time.)