Yann's Forum Posts

  • Whiteclaws

    You don't make an omelette without breaking some eggs.

    If he wants to make a nonogram with C2, I gave him a decent way.

    I won't presume of his level. If he understood what I said, he should be ok, if he didn't, he just have to postpone that project and learn C2 and programming a bit more.

    In any case, my answer has its uses.

    3D array?... wtf?

  • oh nonogram, I did that once

    https://dl.dropbox.com/u/23551572/C2-Ga ... index.html

    If I remember, I just set some strings like

    000########000
    0##00000000##0
    0#00##00##00#0
    #000##00##000#
    #000000000000#
    0#0#000000#0#0
    0#00######00#0
    00#00000000#00
    000########000[/code:dc9g5ywl]
    
    parse it to fill an array
    deduce the numbers to put on the sides.
    check what the player draws each time against the same array for win condition.Yann2013-03-24 12:34:54
  • sqiddster

    all in one file?... doable

    {
      "c2dictionary":true,
      "data": {
        "lvl1_nbClouds":20,
        "lvl1_xSpawn": 102,
        "lvl1_ySpawn": 503,
        "lvl1_greeting": "Hello young traveler, you'll have to... blahblah",
        "lvl2_nbClouds":13,
        "lvl2_xSpawn": 251,
        "lvl2_ySpawn": 134,
        "lvl2_greeting": "Already second level! I might need to get ,
        "lvl3_nbClouds":5,
        "lvl3_xSpawn": 124,
        "lvl3_ySpawn": 162,
        "lvl3_greeting": "Ok, I'm starting to get angry!",
         etc...
      }
    }

    Then you just have to get your data from the "lvl"&curLevel&"_...." keys

  • XML is a pain in the behind

    Just use JSON, it's easy to write and load.

    If you want a list of parameters for your level and if your parameters aren't too complex, you can use a dictionnary JSON. It should looks like that:

    {
      "c2dictionary":true,
      "data": {
        "nbClouds":20,
        "xSpawn": 102,
        "ySpawn": 503,
        "greeting": "Hello young traveler, you'll have to... blahblah"
      }
    }

    That's pretty easy to read, edit and load.

    Unless you have something more complex like a list of different enemies with different parameters... It'should be good enough.

    And well... If you DO have something more involved with a deeper arborescence, you could still do something like

    level1.json:

    {
      "c2dictionary":true,
      "data": {
        "nbClouds":20,
        "xSpawn": 102,
        "ySpawn": 503,
        "greeting": "Hello young traveler, you'll have to... blahblah",
        "enemyDefinition": "enemyDef.json"
      }
    }

    enemyDef.json:

    {
      "c2array":true,
      "size":[4,5,1]
      "data": [[
      //[     type, hp, mp,atk,mag]  <-- that's a comment
        [  "troll",100, 10, 50,  0],
        [  "witch", 50,100, 10, 60],
        ["pikachu", 70, 30, 24, 12],
        [  "demon", 85, 20, 16, 34]
      ]]
    }

    Though using the array syntax it's a bit less clear

  • interesting problem

    decimalToFraction.capx

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • darktoad

    hey thanks for the feedback (:

  • labithiotis

    nope, it's strictly a "polygon" plugin. as in

    a polygon (pron.: /'p?l?g?n/) is a flat shape consisting of straight lines that are joined to form a closed chain or circuit

    If one day I feel good enough in js and if I find a good way to interface it in ACE, and if I find a good way to generate corresponding collision polygon, I might decide to make a "Shape" plugin.

    But as you can see, there's many "ifs" (:

    And if you don't need collision polygons, I suggest you look at the canvas plugin from R0J0hound

    On another subject, I just updated the polygon plugin, I had left some bugs in the boundingbox calculations.

    Enjoy (:

  • Jeff Skyrunner

    Yeah I'm still a bit shy as far as playing with the xml files.

    For now I just use .bat to commit some changes when I work on game series.

    I just split my event sheet into a common event sheet for the engine, and a specific event sheet for specific differences per games in the series.

  • Jeff Skyrunner

    Interesting comparaison. I tried a bit of Java some month ago, and work a bit with ActionScript and they indeed split every class into files.

    But in that case, OOP is enforced by the language, and you tend to build your application around the concept. Whereas in C2, even if you have OOP concepts driving how C2 works, the event sheet itself doesn't really use those concepts (no encapsulation, no real polymorphism,...).

    As far as I'm concerned, after working on some big projects, I noticed that I was losing tonnes of time looking for pieces of code in all my event sheets.

    And for a practical example: in one of my last project I had a createPolygon function. It was all fine, but at some point I wanted to add an angle parameter. I was a bit unsure, since I didn't remember where I used this function. But I just did a simple search on all my event sheet and voil�.

    If I had split everything in event sheet I probably would have had about 10 of them, and it's super easy to overlook one event sheet amonst 10 while you are searching.

    And finding such bug in my 1005 events would have been a real pain :D

  • Joannesalfa

    My remark was more because you were showing me a curviline shape. I wanted to make sure you didn't want to make coffee with the plugin :D

    Now, I won't write an svg to JSON converter.

    But what I can tell you is that you just need to retrieve the value of the points attribute and recreate a json string by grouping the number by pairs

    You can probably write something in C2 directly with 2 text boxes for input/output, and maybe using the xml plugin to retrieve the points attribute and then parsing it using some token function.

    The example you posted should become something like:

    {
        'c2polygon':true,
        'vertexCount' : 5,
        'vertices': [
                        [100,10],
                        [40,180],
                        [190,60],
                        [10,60],
                        [160,180]
                    ]
    }
  • oppenheimer

    Thanks, and I don't think you can make a plugin for that. I mean, it's a whole tool by itself. Plugins just add some simple functionnalities you can operate through action/condition/expression.

    Now, even if this hypothetical plugin were to only read some data this tool output and draw the corresponding graphics. I think you would need some kind of mesh distorsion capabilities as well as some smart tiling effects. Like an enhanced 9-patch.

    For distorsion, it might be achievable with WebGL (meaning, this wouldn't be compatible with devices that doesn't implement it).

    The polygon plugin only uses the html5 Canvas 2D functionnalities. When WebGL is activated, it merely copy the canvas2D texture into the webGL context.

    Joannesalfa

    a polygon (pron.: /'p?l?g?n/) is a flat shape consisting of straight lines that are joined to form a closed chain or circuit

  • Joannesalfa

    Not without some effort on your side (:

    If you're interested the JSON format of the polygon plugin is:

    {
        'c2polygon':true,
        'vertexCount' : numberOfVertex,
        'vertices': [
                        [x0,y0],
                        [x1,y1],
                        [x2,y2],
                        ...
                    ]
    }

    As long as you can create a JSON in such format, the plugin will gladly accept it and you'll be able to draw any polygon.

  • labithiotis

    Yeah you can probably use masking, I still didn't work on texturing, don't know yet how and if I should handle that since there's easy work around like masking as you suggested.

    And with containers it shouldn't be too hard to work with while allowing you to use either tiledbg or sprites.

    I might try some stuff at some point just for testing but I don't promise anything (:

  • Update:

    Action:

    • Add Vertex
    • Move Vertex
    • Insert Vertex
    • -> A new combobox parameter has been added to choose between local and world-space for add/move/insert vertex
    • Set Origin
    • -> You can define a new origin for the object (this well automagically change the local position of the vertices and the position of the object so the origin is changed but the polygon itself doesn't bulge one bit)

    Expression:

    • Right: X coordinate of the right edge of the unrotated bounding box
    • Bottom: Y coordinate of the bottom edge of the unrotated bounding box
    • Left: X coordinate of the left edge of the unrotated bounding box
    • Top: Y coordinate of the top edge of the unrotated bounding box
    • CenterX: X coordinate of the center off the bounding box
    • CenterY: Y coordinate of the center of the bounding box
    • BarycenterX: X coordinate of the barycenter (average of the vertices position)
    • BarycenterY: Y coordinate of the barycenter (average of the vertices position)

    Here are some example of the uses of these new features.

    The bouding box brackets are a 9-patch object placed using the bouding box expressions.

    The blue cross is the bounding box center, the yellow cross is the origin and the gree cross is the barycenter.

    https://dl.dropbox.com/u/23551572/C2-Games/Polygon%20Demo/index.html