Nitro187's Forum Posts

  • You could just have new content as a separate project altogether than just link to it via HTTP.

    Then it would require you to re-load an entire project... and they wouldn't be able to go back and forth easily... just not very efficient I'd assume.

    Would it even be useful to load layout XML files from Construct 2? Then everyone who wants to design levels for your game will (probably) need a C2 license, and you have to share a significant part of the source project in a ready-to-use form...

    More money for you guys, no? In the end, if you're only giving it to people you want to create levels for you.... say if you have a team of level builders for example, then sharing the code shouldn't be a problem anyways... if you even had to. The main reason is for downloadable content, not having to re-download the entire game... just level data. At that point, you already own the source project, and shouldn't be a problem... not to mention, it would be a lot easier for people to implement, than an entire level editor\loader parser. Point to a URL\Filename of the XML data, load it - and treat it like a loaded Layout.

  • I don't see the need. Surely level creation could more easily be handled by importing , for instance, a new json string that contains the layouts for new levels, then just create the levels on the fly based on the new data.

    Granted, not as simple as it would be to have a level you can build by dragging and dropping in the C2 interface... then copy the XML data, and use that as a load level function. The way you're suggesting would require doing everything manually in text format, as well as building a level creation parser, the ease of which strays away from the "Drag and Drop" attractiveness of Construct2.

    I'm thinking more along the lines of the complexity of how some levels can get.... parallax... 20-30 layers... multiple items with different instances..... not something easy to do with what we currently have available.

  • I would like to load a layout\event sheet (just a layout I think would be safer....) that's outside of my project.... for example, for DLC. Is this at all possible? Even through a plugin? Essentially, I would like my customers to be able to download the game... and then as new levels are created, etc etc, people can download small 'patches' or DLC, and it'll read them and load them up as if they were inside the project. I know this is not difficult to do in HTML5... but perhaps this would require a huge undertaking for Construct2 to have as a built in feature.

    Anyone?

  • Cause I only want one instance of my plugin.... to have a canvas, you'd have to require multiple instances - and I don't want that.

    No worries though, I modified the canvas plugin to my liking.

  • scirra.com/manual/156/c2addon-packages

    Yeah, I know about c2addon... however, once you 'install' this addon, it essentially puts the javascript files of your plugin into the users folder... and it's very easy to rip into these and get all your hard work, etc etc. I'd rather have it so they can't do this.

  • However, there will be updates to my plugin over time... is there some sort of opensource application out there that anyone knows of, that I can manipulate (without having to re-invent the wheel), and package with my plugin so that people can just open the application and sync to get the latest version? Just a tiny application is all that's required.

    Second:

    Is there a way I can package my plugin, so that no one else can copy it? I can always minify it... but is that my only option?

    Thanks.

  • What I'm trying to do is capture the output from a webcam, to this canvas plugin - so I can use it as an object..... problem is, the webcam plugin I'm using (different than the built in c2 one. It's proprietary) pretty much copies the output of the webcam directly to the c2 canvas... the only way it can be done.... the problem with this particular plugin however, is that it only pastes from a specified layer... and not "all layers" or "entire canvas".

    Is there some way I could edit the canvas's "PasteLayer" part of the plugin, in order to capture all the layers, or the entire c2canvas, wherever the canvas instance is? Perhaps add a new function "PasteCanvas" ?

    If i'm not being clear enough, let me know.

    Thanks!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Hey R0J0hound,

    I've modified your plugin to my liking, and was curious if you'd like to include it in your code going forward? Here's what I did:

    In EditTime.js

    AddNumberParam("X pos", "The X pos to paste from.");
    AddNumberParam("Y pos", "The Y pos to paste from.");
    AddNumberParam("Width", "The Width of Section to paste from.");
    AddNumberParam("Height", "The Height of Section to paste from.");
    AddAction(23, 0, "Paste Section", "Canvas", "Paste Section Coordinate x: {0}, y: {1}, width: {2}, height: {3} onto canvas", "Pastes Section into the canvas.", "PasteSection");
    [/code:oo4tpvca]
    
    In Runtime.js
    [code:oo4tpvca]	acts.PasteSection = function (x,y,w,h)
    	{
    		var ctx=this.ctx;
    		var buffer = document.getElementById('c2canvas');
    		var bufferCtx = buffer.getContext("2d");
    		var bufferTMP = document.createElement('canvas');		
    		var bufferTMPCtx = bufferTMP.getContext("2d");
    		var myImageData = bufferCtx.getImageData(x, y, w, h);
    		bufferTMP.width = w;
    		bufferTMP.height = h;
    		bufferTMPCtx.putImageData(myImageData, 0, 0);
    		ctx.drawImage(bufferTMP,0,0,this.width,this.height);
    		this.runtime.redraw = true;
            this.update_tex = true;
    	};[/code:oo4tpvca]
    
    I'm sure there may be a better way of doing this... but this is the method that worked for me.  The good thing about this code is, it takes ALL of the layers at the exact point you specify in the C2Canvas.  Great for lots of uses, including mine.  Works great too.  If you're not interested in including it, that's ok... I'll just modify yours every time I need to download it. 
    
    Hopefully other people are able to get a use out of this too.
  • That will only draw on the canvas that the canvas plugin you inserted created for you. I want to be able to draw something on the main Construct2 canvas. Mainly cause my plugin cannot have more than one instance... and this method would force that.

    I also looked inside the canvas plugin, and couldn't find a way to make it draw to the main c2 canvas.... this one will only draw on it's own instance.

  • I'm trying to draw a box directly to the C2 canvas from a plugin... how do I do this?

    I tried the following... but perhaps I'm missing something:

    var c = document.getElementById("c2canvas");
    var ctx = c.getContext("2d");
    ctx.fillStyle = "#FF0000";
    ctx.fillRect(0,0,150,75);[/code:39p9qx1t]
    
     It gives me the error: cannot set property "fillstyle" of null
    
    This exact code works fine in any other javascript... so I'm confused.  I know I have the right canvas name (c2canvas).  Any help?
    
    Perhaps I'm going about this the wrong way... what I want to do, is have only one instance of my plugin, but be able to draw images, and other drawings directly to the canvas at any time, so I'm not limited to just one picture on one layout.  I hope I'm making sense.  The easiest help you could give me I guess, is how can I make that code above work inside a plugin?
    
    Thanks!
  • Awesome.... figures I would have missed that one. Thanks!

    With that, I also figured out how to change the position too:

    Set X- CanvasToLayerX("Layer 0",LayerToCanvasX("Layer 1", sprite2.X, sprite2.Y) ,LayerToCanvasY("Layer 1", sprite2.X, sprite2.Y))

    Set Y- CanvasToLayerY("Layer 0",LayerToCanvasX("Layer 1", sprite2.X, sprite2.Y) ,LayerToCanvasY("Layer 1", sprite2.X, sprite2.Y))

    Thanks again!

  • I have an object that's somewhere outside of my project.... I would like to track it's X&Y exactly, however because it has a different parallax than the 'arrow' i'm using to point at the object, the arrow reads a different X & Y coordinate, showing it off. When it's not zoomed in... it's fine. When you zoom in (layout scale) it screws up, because of the parallax.

    Can anyone help me out? It's 5 in the morning... I've been up all night... probably the reason I'm not figuring this out.... also the reason this may not make any sense to anyone... hence the upload.

    [attachment=0:3kvi0yrc][/attachment:3kvi0yrc]

    Thanks!

  • I don't know... some guy made a "tilesprite" plugin, and abandoned it... so I figured I would make my own version.

  • In case anyone is interested.... I started my own take on this type of plugin.:

  • I've been working on a new version of an old abandoned plugin... and figured I could use some of everyone's help in getting it working perfectly.

    Basically, this makes a Tiled image act like a sprite, with animations and what not.

    It currently only works in non-WebGL mode.... cause I don't know how to fully get it to work in GL. I'm working on it.... but for now, it's non-WebGL only. For some reason, however, it works in both GL & Non-GL in the preview window.

    Thoughts? Help?

    Bugs: -

      Critical: For some reason, it has a major memory leak... and I haven't looked into why just yet. You can see in the demo above as to what I'm referring to. after about 5 -10 seconds, the FPS start dropping.... most likely due to the fact it's leaking memory, but I'm not entirely sure. This only seems to happen on large sprites, and not tiny ones. Any thoughts?
      Does not work in WebGL mode
      Causes a crash in Construct2 every once in a while in regards to textures not being in memory. Only appears to happen when opening the editor and closing without making a change.

    Plugin: http://www.nitrolic.com/water/tiledsprite.c2addon

    Demo CAPX: http://www.nitrolic.com/water/demo.capx

    Demo URL: http://www.nitrolic.com/water

    Enjoy guys.