R0J0hound's Recent Forum Activity

  • Shaders can change what is seen on screen, but they have nothing to do with how often it's updated.

  • In that case you could either use the function object idea or maybe just break the equation up and use multiple append text actions.

  • I usually use the debugger to do that but I have used the function object before to display a bunch of values without having to type out a long equation.

    on function "debug"
    repeat function.paramCount times
    

    text: append text function.param(loopindex)&newline[/code:1brc17pe]

    Then it's simple to just use a function call action and add a parameter per value.

  • Try Construct 3

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

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

    Here is a another example/experiment that implements the custom rotation points per sprite and the beginnings of some simple object hierarchy (only one level for now).

    /examples31/custom_hotspot.capx

    https://www.dropbox.com/s/n54xuhxmxvizf ... .capx?dl=1

  • If the framerate dips below 10 fps then dt is capped at 0.1 so time passed won't be accurate. Usually you design your game to run much faster than 10fps so that isn't really an issue.

    If you really must have it be correct with a framerate below 10 then you could use the wallclocktime expression.

    Basically add this to the top of your event sheet, and then use mdt in place of dt everywhere else.

    global number mdt=0

    global number prevTime=0

    every tick:

    set mdt to wallclocktime-prevTime

    set prevTime to wallclockTime

  • "dt" is framerate independent. In a simple example this should give a value around 1 no matter the framerate:

    global number t=0
    
    every tick
    

    add dt to t

    time=1.0 seconds

    text: text=t[/code:c0mzc8r0]

    No idea why you're getting a framerate dependent result. I don't have cvs plugin installed and you use it everywhere so it's essential to your capx. Maybe I'll install it later but I'm lazy.

  • A plugin can't be made to do that since it's something fundamental that the engine controls, and would need to be changed in the engine itself.

    The purpose of moving stuff with events is in C2 only redraws if something moves or changes viually. If nothing visual changes then the runtime doesn't redraw and just reuses the previous frame's image. By controlling when we move stuff we can control when the screen redraws.

  • In what way is it affected by the framerate? Is the result lower than you expect?

  • For the time:

    dt is the time between the last frame and the current one. It's used in cases where this makes sense:

    rate * time = amount

    For example say a car is going 100 pixels per second then the distance it moves in a frame is

    100*dt = distance

    In the same way if your rate of earning money is (Buy1Value*Buy1Stock) and you can find the amount you earn per tick with:

    (Buy1Value*Buy1Stock)*dt

    Now if you want to update the money with a "every x seconds" then "x" is the time you multiply by instead of dt.

    Every 1.0 seconds

    add (Buy1Value*Buy1Stock)*1.0 to money

    Both are framerate independent, and you should get the same amount added per second either way.

    For the text:

    If you want to switch over to spritefonts, which are faster at rendering, you'll have to manually change everything over. You can keep the normal text objects instead and make it a bit faster if you set "webgl" to off, but that may not be an option if you want to use effects.

    And lastly the mouse "bug":

    Mouse.x and mouse.y use the mouse position on the first layer. I haven't opened your capx but I'd assume the first one is the hud which doesn't scroll. You can use the Mouse.x("layer") expression instead to get the mouse on the layer that scrolls instead.

  • In that case the events could look like this. There's no avoiding the "for each", and even if you could it would still be done internally. For example the "pick closest" condition will actually loop through the objects to find the closest.

    global number x=0

    global number y=0

    global number obj=-1

    For each sprite

    set x to sprite.x

    set y to sprite.y

    set obj to sprite.uid

    --- pick all sprite

    --- [inverted] pick sprite instance by uid obj

    --- sprite: pick closest to (x,y)

    --- > do something

  • Zebbi

    You would have to add up dt for the ticks you don't use.

    Here's my idea. It adds dt to mydt every tick. Then every forth tick the "code" group is enabled which moves the objects around using mydt instead of dt. At the end of the group mydt is reset to 0.

    https://dl.dropboxusercontent.com/u/542 ... 15fps.capx

    This could get very tedious to do. You can't use behaviors or animations with sprites, you'll have to do everything with events to ensure objects are only redrawn on that one frame. On a side note as far as the engine is concerned the fps is still 60 fps but we're only redrawing at 15fps.

    LittleStain

    I suppose you could but it wouldn't save on any performance which I assume this would be for.

  • You could add an image point on the animated object and just set the other object's position to the imagepoint every tick. You could also change it so the animated sprite actually is moving so you could use the pin behavior.