R0J0hound's Forum Posts

  • Hi, I had a quick look at the capx. I also tinkered abit with making objects visible but my implementation of my idea wasn't working right. As to multiple canvas' it's for the additive blending of the lights. Each light casts shadows on its own canvas and then it's additively drawn to the main canvas for blending. I got away with just two canvas' since I can just keep reusing the 2nd canvas for each light. The composition will have to be reworked to incorporate transparency so you can allow textures underneath to show through.

    Here's a rough idea how it could be done.

    I think it's "destination out" that acts as an erase.

    1 draw shadows to canvas c1

    2 fill canvas c2 with the light color

    3 give c1 the destination out blend and paste it to c2.

    C2 will then have the lit areas colored and the shadow areas transparent.

    4 paste the falloff sprite to that too and then paste it with an additive blend to canvas c3

    Do that go each light.

    5 you can then get the shadows again with steps like 2 and 3. The shadows should be now on canvas c4.

    The only 2 canvas that should be drawn are c3 for the light and c4 for the shadows.

    You could then fiddle with the light canvas opacity to adjust the blend.

    There may be some issues with the idea since I haven't tested it.

  • Sorry, I don't login too much and I miss many posts.

    For the first Q you're talking about an object casting shadow and being visible when lit, right? One idea that comes to mind would be to only cast edges facing away from a source. Although it wouldn't work great for concave objects.

    For a texture underneath you could reduce the opacity of the gradient sprites. I don't entirely recall what the example does so I'd have to tinker with it. Another idea would be to reduce the opacity of the color fill.

  • I'd just use the uid instead of iid and uid. Here's a way to rework event 190 to stop creation of duplicates. The else is run only when there are no arrows paired with a pickup.

    +circleBounds: on collision with BoxPickups

    +For each BoxPickups

    ---+ArrGd: ThnUd = BoxPickups.uid

    ------ //nothing

    ---+Else

    ------- //your creation actions

  • Hello,

    For this:

    for(i=0;i<10;i++)

    {

    printf(i);

    }

    The equivalent in C2 would be this:

    for "" from 0 to 9    

    ----Textbox set text to loopindex

    Or if you want a named loop variable:

    for "i" from 0 to 9    

    ----Textbox set text to loopindex("i")

    Lastly your initial event setup in your first post would look like this in c:

    int i;

    for(int loopindex=i; loopindex<=10; ++loopindex)

    {

    ++i;

    break;

    }

    -cheers

  • The action equivilent of the script is a combo select, so in python you would use a integer index. 0 for the first resource, 1 for the second and so on. To use a filename you'll have to use "play from file" and have the files alongside your exe.

    You could alternatively use the resource plugin to avoid integers.

  • Since C2 has a visual editor I'd recommend putting a barkeep at each bar and making them all invisible except for one at a time. That way it's easier to tweak the barkeeps position rather than adjusting numbers manually. For the bar top/start/end you could again just use the editor to position the bars and use expressions. Another way would be to store the bar info in instance variables for each barkeep, if you prefer numbers.

    Oddly enough the C2 events will be practically the same as C.

    Here's a wip capx to pick apart:

    https://dl.dropboxusercontent.com/u/5426011/examples18/tapper_ex.capx

    It uses a container so each barkeep will be picked with it's respective bar. It also uses the bullet behavior to handle the mug motion, although you could do it straight with events if you wanted.

  • What i did is when creating the list of possible moves i stored the direction back to the previous move position. My capx kind of obscures the idea so here's a general idea of what I did.

    Here's some ascii art to show the map and perhaps what values could be in the array. Note: i didn't use these values in my capx.

    key:

    . is empty

    # is a wall

    p is a player

    .....
    .##..
    ..#p.
    .....
    

    So that's the map.

    Next I marked the moves. The numbers show the distance away from the starting location.

    .4323
    .##12
    .4#01
    43212
    

    I think you already solved this one but here's my pseudo code for how i generated this.

    mark the players position as 0
    for i from 0 to 3
       loop though all positions marked with i
          for the four positions around each
             if it doesn't have a value and it's not a wall then
                set it's value to i+1
                set it's dir to the direction from the position with value i.
    

    So here is what the dirs could look like. There can be multiple paths with the same distance, but only one will be arbitrarily chosen.

    .<<^>
    .##^>
    .v#p>
    <<<vv
    

    In my code I used 0-3 instead so I could just multiply it by 90 and get an actual direction.

    The backtracking is then just a matter of:

    1 Starting a the destination

    2 look up the direction at the current position.

    3 save direction to a list.

    4 follow direction backward one spot

    5 If current position isn't the starting position then repeat at 2

    Hope that helps a bit to show what I was doing... It may just be noise though.

  • delgado

    The only thing that stands out would be event 11. Change the "repeat 5" condition to the dimension of your letter grid. Ex. 6x6 use "repeat 6", 10x10 use "repeat 10".

  • Events are faster than python. Mainly because of the interpreter warmup and overhead to call actions and expressions from python. The difference only matters if it's done every frame. One time stuff like this is fine and you get the benefit of easy code reuse for other caps.

    Here's a reason why your code isn't working.

    Create and spawn actions take a string for the object name. So instead of:

    Cell1.SpawnObject(WallUp, 6, 0)

    use

    Cell1.SpawnObject('WallUp', 6, 0)

  • You can access the last created instance with:

    SOL.txt_option[0]

    But this won't help if you create multiple instances at once.

    You could make a function like this to return a reference to a newly created object, then you could store the references in a list or something.

    def my_create(name, layer, x, y):
        System.Create(name,layer,x,y)
        return eval("SOL."+name+"[0]")
  • Try Construct 3

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

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

    This plugin is faster when using webgl. With canvas2d it's the same speed as the canvas plugin.

  • Paster 0.5

    Here's a new plugin that is like the canvas plugin in that you can draw (or paste) other objects onto it's texture. It's simpler though and doesn't have any additional drawing features. The big difference is this plugin cleanly uses webgl and allows pasting objects with effects.

    Actions:

    • Paste object
    • Set resolution
    • clear with color
    • Draw Quad

    Key features:

    • Works fast with canvas2d and webgl, without the slowdown the canvas plugin had.
    • Paste objects with webgl effects applied.

    As a side note it's labeled as alpha since the effect rendering isn't complete yet so there are cases where effects aren't drawn right. Also the eventual plan is to merge the webgl fixes back to the canvas plugin, but I'll need to come up with ways to replicate all it's features in just webgl.

    Download:

    https://app.box.com/s/rqwa6kjgttz777wyl7fxvmrv5tiozsj8

  • I made some progress with using webgl in plugins today. For instance here is a progressive blur.

    <img src="https://dl.dropboxusercontent.com/u/5426011/export/blur/images/screen.jpg" border="0">

    https://dl.dropboxusercontent.com/u/5426011/export/blur/index.html

    It's a start but it's not usable yet.

  • SirSpunky

    It is most likely the webgl issue. If the performance is high then canvas2d isn't being used. If performance is low then webgl is being used. Different browsers have decide differently whether or not to use webgl or canvas2d depending on your graphics card. Node-webkit tries to force webgl to be enabled which may differ from what chrome usually does.

    In other news... A NEW RELEASE. Download on first post.

    [change] New icon thanks to paradox.

    [fix] Invalid colors would break "gradient fill" and "flood fill".

    • The default behavior when using a invalid color is black is used.

    [add] Added expressions to get individual components from colors: red,blue,green, alpha.

    [fix] A typo fix and a few other fixes that I don't recall.

  • clrammer

    It is something that would have to be fixed on the plugin side.

    tulamide

    That's not picky at all. I fully agree its ideal to have consistency. I'll shoot for the default behavior for an invalid color to use black instead as this is what html5 does. Gradient and fill should handle colors the same way. I'll have to see why gradient causes an error. Flood fill is a bit different as internally it uses numbers instead of a string. I should be able to fix that. Also thanks for pointing out the typo with horizontal.

    I'll try to get an update out sometime this week. Keep up with the bug reports and feature requests.

    newt

    Actually the HTML colors only take integers for rgb colors even though alpha is a float. Right now the colors are passed as is. I'd prefer not to have to do analysis on the string if I can before passing it.