Hello Guest

Author Topic: Ogmo  (Read 10615 times)

0 Members and 1 Guest are viewing this topic.

gabelikesprogramming

  • Member
  • Posts: 2
    • View Profile
Ogmo
« on: December 13, 2013, 03:58:34 PM »
I would like to know if ogmo editor files are compatible with otter2d.

Kyle

  • Administrator
  • Member
  • Posts: 259
    • View Profile
Re: Ogmo
« Reply #1 on: December 14, 2013, 12:29:39 AM »
Ogmo files are just XML, so you can parse them yourself into any project made with C# including Otter.  There is an OgmoProject class that can also help with quickly loading levels by using Ogmo Editor project files.

gabelikesprogramming

  • Member
  • Posts: 2
    • View Profile
Re: Ogmo
« Reply #2 on: December 14, 2013, 09:35:56 AM »
Thanks, I am a beginner, so It's a little unfamiliar.

floatvoid

  • Member
  • Posts: 11
    • View Profile
Re: Ogmo
« Reply #3 on: January 01, 2014, 04:52:07 PM »
Hey there! I recently started using Ogmo and have had success getting ogmo levels/projects loaded up in an Otter project. It's pretty straightforward if you page through the OgmoProject class but I might do a little guide (do we have a wiki??)

There was a minor bug with the tilemap loading bitstrings that makes it impossible to load an Ogmo project currently. I sent a pull request for the little fix on the bitbucket.

Entities get loaded up and everything is snazzy!


Kyle: This is only semi-related, but what is the ideal method of collision detection with something like BasicMovement combined with a GridCollider. I'm not sure what the intended best practice is for that. I haven't messed with collision much at all yet!
@floatvoid on twitter

Kyle

  • Administrator
  • Member
  • Posts: 259
    • View Profile
Re: Ogmo
« Reply #4 on: January 13, 2014, 12:38:46 PM »
Using a grid collider for the tiles is the best bet.  For the actual moving thing, doesn't really matter.  A box collider would be the fastest, along with a circle collider.  Pixel collider would be the most expensive.

I'll get that change in soon, still in traveling/holiday mode for a little while longer!

pat

  • Member
  • Posts: 5
    • View Profile
Re: Ogmo
« Reply #5 on: January 20, 2014, 10:08:22 AM »
Here's an example Ogmo project use from what I've got working:

Code: [Select]
            OgmoProject proj = new OgmoProject("Assets/Levels/PatWasLonesome1.oep", @"Assets/Images/");
            proj.RegisterTag((int)CollisionTags.Walls, "Walls");
            proj.LoadLevel(String.Format("Assets/Levels/Level{0}.oel", level), this);
            proj.BaseTileDepth = 8;
            proj.TileDepthIncrement = 8;

Your Ogmo entities require a static method,
Code: [Select]
public static CreateFromXml(Scene, XmlAttributeCollection) so the OgmoProject can setup your scene.

floatvoid

  • Member
  • Posts: 11
    • View Profile
Re: Ogmo
« Reply #6 on: February 04, 2014, 12:22:44 AM »
Here's an example of how to use entity properties from Ogmo (as seen in my screenshot above)

Code: [Select]
        public static void CreateFromXML(Scene scene, XmlAttributeCollection xmlAttr)
        {
            BadDude d = new BadDude();

            foreach (XmlAttribute attr in xmlAttr)
            {
                switch (attr.Name)
                {
                    case "id":
                        d.Name += attr.Value.ToString();
                    break;

                    case "x":
                        d.X = Convert.ToInt32(attr.Value);
                        break;

                    case "y":
                        d.Y = Convert.ToInt32(attr.Value);
                    break;
                   
                    case "Weapon":
                        d.weaponType = (WEAPON_TYPE)Enum.Parse(typeof(WEAPON_TYPE), attr.Value);
                        d.label.String = attr.Value;
                       
                    break;

                    case "health":
                        d.health = Convert.ToInt32(attr.Value);
                    break;
                }

            }
           
            d.SetGraphic( Image.CreateRectangle(16, Color.Red) );
            scene.Add(d);
        }
@floatvoid on twitter