tulamide's Forum Posts

  • I want each enemy to have a little healthbar. So my event looks like:

    For each enemy -> Spawn monster_healthbar.

    I'm have no hand on construct right now. But from my mind: Isn't 'for each enemy' true every tick? If you just want to happen this once you have to further limit it, for example for each enemy that doesn't have a healthbar yet, or something.

  • It seems that Cinema 4D is also very capable of such things.

    http://www.maxon.net/en/products/modules/modules/thinking-particles/particles-in-motion.html

    But, Construct is not designed to be the most flexible graphic creation, but the most easiest and fast game development tool.

  • What it does

    What can be done with Disk.fx? Well, this:

    Heck if we had a radial gradient you could even do a Warner Bros. title screen.

    h2]Original

    Ok, sort of, but at least I try

    The boring basic explanation is, Disk allows you to focus on a part of an object using an oval shape by darkening everything outside the shape.

    Disk takes care of transparencies and semi-transparencies and offers a set of parameters to suit your needs.

    Two useful .cap-files, not only showing the effect in action, but letting you tweak a bit also to get a first impression of the capabilities, are provided.

    One limitation: Unfortunately, the important values of pixelWidth and pixelHeight are always passed incorrect to an effect (at least on my system). So there is no chance to take care of the aspect ratio. In other words, you will only get a perfect circle, if the object the effect is attached to is of a square size. I first thought about letting you pass the aspect ratio manually, but I rather decided to do an update when the bug is corrected.

    How to use it

    • Size Defines the size of the shape in percentage of the object's size.
    • Horizontal Center Defines the horizontal position of the shape in percentage of the object's width.
    • Vertical Center Defines the vertical position of the shape in percentage of the object's height.
    • Smooth Border Defines the smoothness of the shape's border (0% = sharp, 100% = gradient to the center).
    • Darken Defines, how much the area outside the shape is darkened (0% = White, 100% = Black).
    • Opacity Defines the opacity of the darkening color (0% = Transparent, 100% = Opaque).
    • Replace Content *Handle with care* A simple switch (0 = Off, anything else = On). Almost always you don't need Replace Content. But in certain situations it can be useful. For example, if you want to use a Tiled Background as a layer effect (TB uses less VRAM than Canvas), you can setup a very small empty image in the TB and then activate Replace Content. It will then draw its own image with a 100% transparent shape and a darkened outside area. In the car.cap Replace Content is used on a Canvas to create a subtle dust effect.

    Installation

    Download and place Disk.fx in the effects folder.

    Download

    Disk.fx

    Disk.cap

    Car2.cap

  • Nice one!

    Just one thing: If you want the scanlines to stay with the sprite, when a sprite with this effect moves, you should use boxTop like so:

    float darken = 2*abs((((Tex.y - boxTop)*tot) %1)-0.5);[/code:1d2q3v7p]
    
    Thank you for this one, will play around with the code
  • Coordinates in the runtime go from 0 to 1, from top to bottom and from left to right of the screen.

    In the Editor, though, this is from the edge of the EDITING WINDOW, not the layout, so effects get different coordinates.

    That said, you are testing for an int result of a modulus

    so if you were thinking integer pixels

    vpos=0 -> vpos%2 = 0, darken
    vpos=1 -> vpos%2 = 1, ignore
    vpos=2 -> vpos%2 = 0, darken
    vpos=3 -> vpos%2 = 0, ignore[/code:35mxhfk7]
    
    but the shader is fractional
    [code:35mxhfk7]
    vpos=0 -> vpos%2 = 0, darken
    vpos=0.3 -> vpos%2 = 0.3, ignore
    vpos=0.7-> vpos%2 = 0.7, ignore
    vpos=1 -> vpos%2 = 1, ignore
    vpos=1.2 -> vpos%2 = 1.2, ignore
    vpos=1.7 -> vpos%2 = 1.7, ignore
    vpos=2 -> vpos%2 = 0, darken[/code:35mxhfk7]
    
    As you can see, depending on the size in pixels the effect will look very different.
    
    I recommend the following test instead
    [code:35mxhfk7]if(vpos%2 > 1)[/code:35mxhfk7]
    ALL THAT SAID.... yeah, the diagonal line shouldn't be there at all, and the scanlining should be regular, so yeah it looks like a bug in effect coordinates.....
    
    MORE TESTING REVEALS that this effect only happens when there's more scanlines than physically possible (half the vertical resolution). Why? no idea, but while testing, I ended up writing a full scanlines shader, so here it is.
    
    EDIT: Posted as addon: [url]http://www.scirra.com/forum/viewtopic.php?f=29&t=5643[/url]
    you may change number of shown scanlines, scanline width and intensity of the effect. No offset, because I didn't feel like it.
    

    Thank you very much, madster

    I am mislead by "pixelHeight". I thought it was the factor, the height of one pixel in units and that coordinates would give results in units orienting at pixelHeights, so that dividing would lead to integer pixel values. Listened and learned.

    I will post to the tracker, and hopefully find workarounds for the bug in transmitting the coordinates to the shader.

  • Before posting to the tracker, I want to make sure that I am not doing anything wrong. I am currently testing for a few effects in mind, but the results are unexpected.

    For example, this code:

    float4 EffectProcess( float2 Tex : TEXCOORD0 ) : COLOR0
    {
        float4 color = tex2D( foreground, Tex.xy );
        float vpos = (Tex.y - boxTop) / pixelHeight;
        int test = vpos % 2;
        if(test == 0)
            color.rgb *= float3(0.5, 0.5, 0.5);
    
        return color;
    }[/code:20hyqrqi]
    
    leads to this result in the editor (better look at the original size):
    [url=http://www.bilderhoster.net/img.php?id=z5z9wjjs.jpg][/url]
    exactly what I expected. Every second line darkened, beginning with the first line. However, when I run the layout or export to exe, I get this result:
    [url=http://www.bilderhoster.net/img.php?id=hvgyjgwr.jpg][/url]
    
    How come? Any idea, or should I post to the tracker?
  • Select the animation, in the tab on the left side of the editor you will see all properties.

  • I can't for the life of me find that shader now though... I know it's here somewhere on the board. I can't even remember who made it. It's not linkman's hue shader, because that changes all the colors at once, not just one of them. Argh, I really wish people would put their finished plugins into the Completed Addons section

    It is called (tadaa) "Color Replace", created by lucid, and can be found in this thread:

    http://www.scirra.com/forum/viewtopic.php?f=17&t=4234&hilit=color+replace&start=10

    Does the shader take into account semi transparencies, or offer a color range?

    No, and no.

  • You could count down to zero over time. In another event you could use a random value for milliseconds to take the current value and present it.

    -Every 5 milliseconds

    -Every random(1000) milliseconds

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • sweet, does it preserves alpha?

    Yes. Well, at least with the sprites I tested it with

    that's cool

    I think I'll be using this in my game if it's dynamic and all that

    I'm not quite sure, what you mean. The parameters are changable during runtime, of course. Smooth transitions when using TimeDelta are also possible. A built-in parameter animation is not present.

  • NEW VERSION (Dec 14, 2010)

    This effect just merges a certain amount of a chosen color to the original. I did this one, because I didn't find a simpler one.

    How to use it:

    Red

    Green

    Blue

    These first three parameters define the color you wish to lay over your image in color values (0-255)

    Intensity Defines the amount of the color in the resulting image. The more amount the less original colors. (for example {red 255, intensity 100%} totally replace all original colors with shades of red)

    Install:

    Download and put "color fusion.fx" in the effects folder.

    Download:

    Color Fusion.fx

  • i guess my question was why do you need to set something, why not just

    Function.setstartvalue(1000,1000,300,1)

    Because it is not implemented

    If you want to pass parameters to a function without the need of a return value (like in your example set text) you have to set the parameters seperately and then call the function. It is part of the concept - the way of calling a function with a return value directly within the expression is just a shortcut for your convenience

  • I confirm. "On load" is triggered only after a "load" or "quickload" action.

  • Ok, I'm confused now. Is the red line what you want to achieve?

    If so, qarp might be your best choice (a thread shows how to use it best, if I remember right)

  • > It's easily possible in events! You just need a little math. If seconds is your number in seconds, floor(seconds / 60) is the minutes (divide by 60 and round down), and seconds % 60 is the seconds counter (modulo 60, ie. remainder after dividing by 60).

    >

    what if you have above 59 minutes and you want hours too?

    hours: floor(seconds / 3600) (or: seconds / 60 / 60)

    then use the result of seconds modulo 3600 for the rest of the calculations as seen above

    totalseconds = 3980

    hours = floor(totalseconds / 3600) = 1

    totalseconds = totalseconds % 3600 = 380

    minutes = floor(totalseconds / 60) = 6

    seconds = totalseconds % 60 = 20

    ZeroPad(hours, 2) & ":" & ZeroPad(minutes, 2) & ":" & ZeroPad(seconds, 2)

    "01:06:20"

    yeah, nice

    EDIT: I forgot, in case someone asks for days too, just start with floor-dividing by 86400 (=3600 * 24) and use totalseconds % 86400 for the rest of the calculations.

    Now try to find yourself the right value for weeks