R0J0hound's Forum Posts

  • 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.

  • Try Construct 3

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

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

  • Right now the way it's done is to load it into a sprite and then pasting it back into the canvas.

  • cantek

    That would be a very useful feature to have. Right now I end up analyzing by visually walking over my events and imagining the results of each one. Its not ideal and I often have to do some tests in a separate capx to see what a particular condition or actions does before I can analyze it in my events. It would be much easier to see what's going on if the debugger allowed you to step through events and see what's picked at each step. It would be and invaluable tool IMO especially for beginners as it would show you exactly what's happening.

    It's the main feature that's lacking from the debugger that would make it like a debugger for standard programming languages.

  • tulamide

    That memory leak comes from the texture not being freed when the canvas is destroyed. It only occurs on xp with webgl on and I can't fix it... but I'm not sure why.

    In other news I had a go at making a proper webgl fix and ran into too many issues to get it to work. C2's runtime isn't designed for it and I lack the technical knowledge, ability and time to get something working. So for the foreseeable future my recommendation is to use the plugin with webgl off for the best speed.

    Alpro

    I suppose it's doable but it doesn't really fit in with the canvas' purpose. Pasting a canvas with the spritesheet to a smaller one is a cleaner solution imo.

    Paradox

    I'm not offended at all. That's one nice looking icon. I'll include it in my next update. Thanks.

  • A way to do it would be to convert the bezier curve to a polyline. The more points you use the better the approximation of the curve you will get.