R0J0hound's Recent Forum Activity

  • It's actually pickable at the next toplevel event too.

  • korbaach

    The difference is how colors are matched there. It checks if the colors are close, not exact.

  • rufson

    I couldn't get the "load texture from canvas" action to work reliably when I was implementing it. The issue is it seems to rely on some undefined behavior with webgl unfortunately, so it should probably be removed from the plugin.

    On another note webgl support for my graphics card is poor so even with webgl on it's not used when I preview. Support was better with older browsers oddly enough. As a result I have done nothing with webgl for a while now, so I probably won't have a fix for this.

  • You can't do that with z order. you could do it if you have the pink object on another layer with "force own texture", you'll need a forth object on that layer with the destination out blend over where you want to see through to the blue object.

  • Use a textbox instead, and set the font size with some css. You can even scroll the editbox by using some javascript with the browser object.

    https://dl.dropboxusercontent.com/u/542 ... croll.capx

    The issue with the Text object is you're running into the browsers canvas size limit, and with webgl the texture size limit. You can circumvent it by using one text object per line if you still prefer to use them.

  • Couldn't you use the "on collision" condition?

  • Sounds like you want to save video memory. My idea above does nothing for that.

    Images are loaded/unloaded per layout:

    https://www.scirra.com/blog/112/remembe ... our-memory

    The most you could do is try do some juggling with animation frames, by just loading frames from a file as needed. Which would replace one image with another. I wouldn't go that route unless I was running out of video memory, and even then I would probably do something else since loading images from a file is slow.

  • 1. yes with the sdk:

    https://www.scirra.com/manual/15/sdk

    2. I think so. Depending on the export method there is a plugin for it to access exposed api features of the exporter. Not all but you could perhaps modify the plugin to access more features of the api.

    3. Again with the sdk. You can use the Browser object's execJs action to run snippets of js too, but it's unconnected with the rest of C2 and can break after exporting due to minifying.

  • It's not as simple as you'd assume and it actually wouldn't save on memory so much, unless you Incorporated loading from disk. It could save on cpu usage by reducing the amount of objects to process, but it will also take some performance to do the chunk loading. Also while it works ok for static terrain it becomes more complicated if you want stuff to be changeable. Moving objects are a big problem with this as well as they can move around and it may not be desirable to save them to a chunk.

    As a simple example with only horizontal scrolling and a screen size of 640x480 you could do the following. Say you want a chunk width of 640 pixels at any given time you could have 2 of them loaded, and for example we could define the center of the chunk to be it's location.

    We need to know two things: when to load a chunk and when to unload it. What can do is as the chunk gets too far left of the screen it gets unloaded and a chunk on the other side gets loaded.

    chunk.x<scrollx-640

    unload chunk

    set chunk x to self.x+640

    load chunk

    Also it can be done similarly if two far to the right.

    For the unloading I'd use instance variables on the objects that have the chunks id so you can pick them to destroy. For loading you'll need to store the object info in some kind of format. In the past i've used an array as json string to store the data. I'd store the values like this:

    array.at(x, 0) = type

    array.at(x,1) = x

    array.at(x,2) = y

    ...

    So to load it would loop over that array and create objects according to type. I've also done it so it's just a 1d array of dictionaries asJSON.

    The chunks themselves could be stored in an array of those json strings.

    I'd avoid all the above if I can. The goal should be to use less cpu. Just make the entire level in the editor. All the static objects are fine and you if you use a collision detection to pick the objects C2 has everything divided up into screen sized chunks so you can avoid processing far away stuff. Moving objects are the main issue to handle. A common thing is to disable or destroy them if they get to far from the screen.

  • Just to add onto fisholith's excellent post, here is an alternate equation that also gives a signed angle difference.

    angle_delta = angle(0,0,cos(b-a),sin(b-a))

  • dilk

    The simplest way to do it would be to fill a tilemap with a duplicate of your collision mask.

    To do this you'll need a tilemap with a 1x1 tilesize that covers the area of your collision mask image. It's only for collision detection so it can be invisible.

    Next you'll need a canvas object with the collision mask as its image.

    Then at the start of layout use two for loops to loop over every pixel. Use a system compare with canvas.alphaAt(X,y) to read the alpha of the pixel. If it's say >128 then set a tile on the tilemap at the same position.

    At the end of it the tilemap will be ready for collisions and all behaviors can interact with it. It can take a while to do, so as a speed up you could save the tilemap as json and use that in your actual game.

  • Try Construct 3

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

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

    Cool looking effect.

    Sorry, I don't use any mobile devices for testing and even so I have no idea why they work differently in some cases. This plugin is basically a thin wrapper to use c2's webgl renderer to draw to a texture. Which is something the renderer does with layers at times. So the performance is what it is, not much I can really tweak.

    Skewing would be annoying, maybe you could use only power of two sizes?