R0J0hound's Recent Forum Activity

  • For something like a gui it's pretty common to have all the peices of the graphics in one texture.

  • One way would be to use an imagepoint, and use Sprite.imagepointx(1) instead of Sprite.x. The same for y.

  • An object can either have one image like tiledbg or animations like Sprite defined with the pf_texture or pf_animations flags. Not sure if you can have it load more than one texture by default though.

    As far as drawing goes you can draw the two textures any way you'd like at runtime. The edittime is more limited though. You'll have to look at the Sprite plugin to see how different animation frames are used for drawing in the editor. Also it doesn't look like you can control the blend modes for the editor from the sdk, but maybe I haven't looked well enough.

  • I can have another go at it on another PC if I get a chance, but it's not simple to add. Previous attempts were requiring too much code to tweak.

    Overall C2's webgl renderer is made to work well with the screen and not arbitrary rectangles like this plugin does. Ideally I'd just call some functions from the renderer but as it turns out instead I needed to copy and heavily modify most of those functions. Pasting objects with effects is one such example and there are differences with my code that can make the pasted image not look the same. There's probably a simpler solution I haven't come up with yet but it'll probably be very hacky.

    That is probably one good reason why such a plugin like this would have benifited from being made officially. They could then be able to tweak their renderer to make such a plugin more streamlined.

  • You can do what you want with a instance variable "parent" that you'd set the the parent's uid.

    The tediousness would be the picking other instances of the same type. The two way is either a family or storing values from another instance to variables. Functions would also be useful here to make the events more readable.

    For example if your object types look like this:

    sprite: ogre

    family: otherOgre

    variable: parent=-1

    Then your events could look like this:

    // this creates the hierarchy
    //  Ogre spawn 5 ogres, those ogres spawn 2 ogres
    
    Start of layout
    repeat 5 times
    for each ogre
    

    ogre: spawn otherOgre

    otherOgre: set parent to ogre.uid

    ---repeat 2 times

    ---> otherOgre: spawn ogre

    ---> ogre: set parent to otherOgre.uid

    on function "getParent"

    function: set return value to -2

    ---pick ogre by uid function.param(0)

    ---> function: set return value to ogre.parent

    global number dist=0

    global number ang=0

    global number X=100

    // ogre is the grandson, otherOgre here is the grandfather

    // i don't want the grandsons to be further than X distance from his grandfather

    for each ogre

    pick otherOgre by uid function.call("getParent", ogre.parent)

    set dist to distance(otherOgre.x, otherOgre.y, ogre.x, ogre.y)

    set ang to angle(otherOgre.x, otherOgre.y, ogre.x, ogre.y)

    --- dist > X

    ---> ogre: set position to otherOgre

    ---> ogre: move X pixels at angle ang

    //the grandfathers will move to his sons

    // here otherOgre is the father, ogre is the son

    for each ogre

    pick otherOgre by uid ogre.parent

    otherOgre: move 100*dt pixels at angle angle(otherOgre.x, otherOgre.y, ogre.x, ogre.y)

    //At the same time, the 5 grandfathers are not related so they will fight each other but will not harm their own family and will not damage grandsons of anybody, but the grandsons may hurt their own brothers but not their fathers.

    // If I understand that correctly you want

    // 1. gradparents to fight with each other

    // 2. grandchildren to fight with brothers

    // ogre and otherOgre are grandparents

    ogre: parent=-1

    otherOgre: parent=-1

    for each ogre

    for each otherOgre

    fight

    // ogre is a grandchild, and otherOgre is a brother

    ogre: pick by comparison function.call("getParent", ogre.parent) = -1

    for each ogre

    otherOgre: parent = ogre.parent

    for each otherOgre

    fight[/code:143vi5gb]

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

  • Try Construct 3

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

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

R0J0hound's avatar

R0J0hound

Member since 15 Jun, 2009

Twitter
R0J0hound has 157 followers

Connect with R0J0hound