Yann's Recent Forum Activity

  • 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

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • 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

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

    capx: ninjaStroke.capx

    polygon plugin: polygon.zip

    polygon plugin topic: http://www.scirra.com/forum/topic62075.html

    should work with multi-touch but I have no devices so I couldn't test

  • Without force own texture, imagine that all your objects are gathered in one layer (respecting the their layer repartition for z sorting) and then rendered

    If a layer has force own texture on, their object will be kind of baked into one canvas, and then this intermediary rendering will be used instead of the objects (this intermediary rendering is what makes using force own texture slightly slower)

    The consequence of that, is that effects are limited to one layer. If you burn hole you can, in a way control which which object you will affect this way.

    In your implementation, you put an effect on the entire layer, so it will be applyed to everything underneath.

    If an object is in Destination-in, everything underneath its transparent pixels will be erased, else revealed.

    Since your layer is mostly transparent except for the few light sprite that are on it, only what's under your light sprites will be revealed, else you'll see the background of the HTML element containing the C2 canvas (gray in the preview)

    You see black in the editor, it's because it's the color of nothing (:

    destination in totally erased eveything on the viewport.

    Try changing the background color of your Lighting or Background layers you'll see nothing will change, the black isn't the color of your Lighting layer (how could it be, it's a transparent layer (: )

  • Hey neat art :D

  • That's php.

    If you have a server that runs php you can create a file name for instance

    list.php

    you copy/paste this code in it

    you put this file where the images are

    and you modify event 2 to call list.php instead of list.txt

    The php script will just look into the folder it is in, list all the files with extension, png, jpg, gif, or bmp like they are in list.txt (one file by line)

    It's just more automatic. It facilitate update since you'll just have to add images in the folder.

    However you'll have no control over ordering. (I don't know if the script orders alphabetically, or by date of modification...)

  • easy peasy... updated

  • imageViewer.capx

    A basic example with Canvas plugin

    you need to put a file named list.txt in the folder IMAGE_FOLDER (by default 'gallery') relative to your index.html

    In this file, you should have the list of images like that:

    myImage1.jpg
    myImage2.jpg
    myImage3.jpg
    ...[/code:2yju6fwg]
    they should be in the same folder as list.txt
    
    Then it should work like that:
    [url=http://dl.dropbox.com/u/23551572/C2-Games/ImageViewer/index.html]http://dl.dropbox.com/u/23551572/C2-Gam ... index.html[/url]
    with list.txt
    
    Using canvas was the only way to avoid reloading the image each time since you can't have different texture per instances of a sprite.
    The alternative idea was to set enough blank frames in the image sprite and load your image in each of them.
    But using canvas you can have any number of images, you'll just have to upload images and update list.txt without having to worry about re-exporting a capx.
    
    And if you need a php script for automatic listing, that should be enough:[code:2yju6fwg]<?php
    $imageDirectory = '.';
    $allowedExtensions = 'png,jpg,gif,bmp';
    
    $dir = opendir($imageDirectory);
    $ext = explode(',',$allowedExtensions);
    
    if ($dir) {
        while (false !== ($entry = readdir($dir))) {
             $info = pathinfo($entry);
             if (in_array($info['extension'],$ext)) {
                echo "$entry\n";
            }
        }
        closedir($dir);
    }
    ?>[/code:2yju6fwg]Yann2013-02-09 21:51:05
Yann's avatar

Yann

Member since 31 Dec, 2010

Twitter
Yann has 5 followers

Connect with Yann