R0J0hound's Forum Posts

  • I'm not sure you need dt at all in those equations. Speed is just a number, but when you apply a speed to position then you apply dt. In the same way you'd use dt when applying an acceleration to a speed.

    speed1 = 1200

    speed2 = 600

    total_speed=speed1+speed2

    //applying speed to move an object

    sprite: set x to self.x+speed*dt

    //applying acceleration to change speed

    add acceleration*dt to speed

  • There isn't a maximum layout size except for how big a number you can fit in a 64bit floating point number, so ~1.7*10^308.

    What Fengist describes is the maximum texture size for a text object, but this is dependent on what your graphics card can handle. Basically how big of an image it can handle, but then again this has nothing to do with layout size.

    Anyways how many objects you can have on the layout will vary a lot. The two things that will cause a slowdown are:

    1. Amount of things on screen at once. It takes time to render stuff.

    2. What objects actually do and what your events do. This is a very wide range though. It's possible to use well above 1600 though.

  • Here's how I like to do deceleration. You add or subtract from the speed depending if it's positive or negative, and the min/max is to prevent acceleration after passing 0.

    if speed>0

    --- set speed to max(speed-deceleration*dt,0)

    If speed<0

    --- set speed to min(speed+deceleration*dt,0)

    You can use any value for deceleration. If you want it to stop in a certain distance you could use this formula:

    Deceleration=(starting_speed^2)/(2*distance)

    You could probably set that under a on collision event.

    If you want to check the speed of a Sprite from events the easiest way would be to read it from a behavior expression or if you're moving with events you hopefully have a speed variable to control how fast it goes.

    Besides that you can find the speed by keeping track of the object's previous position and calculating the distance from the current position. After that you divide by dt.

    Speed=distance/time

    Global number oldx=0

    Global number oldy=0

    ...

    // bottom of the event sheet

    Every tick

    --- set text to "speed: "& distance(Sprite.x,Sprite.y, oldx,oldy)/dt

    --- set oldx to Sprite.x

    --- set oldy to Sprite.y

  • That doesn't rule out driver bug, but it may also be a limit of your graphics card, specifically the maximum texture size. There are ways of finding out what size that is and knowing the graphics card is one way.

    At what size does the image start getting distorted? Usually the texture size limit is a multiple of 2 like 1024x1024, 2048x2048, 4096x4096, etc...

    The image in your images is 2500x188 so maybe the max texure size is 2048x2048 for your card, but that's just a guess.

    The texture is fine when you run it which makes me think the canvas2d renderer is being used instead of webgl. You can check this with the "renderer" system expression. Webgl has the same limitations as the editor's renderer which uses OpenGL. Canvas2d on the other hand can handle larger image sizes but is slower than webgl.

    Solution? Probably just use smaller images, or slice the image up into smaller images.

  • I only looked quickly before. If the object is overlapping a wall then both your overlap events will run since you're not moving the object out of the wall. Consider if the object has a speed of 1 and hits a wall. The first overlap event sets the speed to -3, and the next event will set it back to 1. You don't get the same effect if the object moves to the left since only the second event runs.

    You could possibly solve it with sub events so only one or the other is run, not both. I used "speed" instead of "xacc".

    Sprite: is overlapping wall

    --- speed<0

    --- > add 4 to speed

    --- else

    --- speed>0

    --- > subtract 4 from speed

  • It probably has to do with using the XDir boolean. How about instead just check if Xacc is greater than or less than zero in your overlap events?

  • I think the thing you're looking for is "dt". The reason your movement is jittery is the time per tick varies. "dt" is the length of time of the current frame. You can utilize that to find how far to move. The simple equation is:

    Speed*time=distance

    So dt would be the time.

    For speed you wanted 5 pixels/tick and since there is 60 ticks/sec your speed would be 60*5 or 300 pixels/sec.

    So your action would be:

    Sprite: set X to self.x+300*dt

    Another benefit of using dt is the object will now go the same speed no matter the framerate.

    You could get the same result using a behavior but it can be useful to do it with events. In this case it doesn't really matter either way.

  • Colludium

    Got a plugin for this working. The renderer seemed to be a good challenge.

    It's webgl only and only plays the default Creature animation. Actions/expressions to change the animation, start, stop, animation speed, query bone locations etc could be done later, and actually should be rather easy to add if anyone wants to have a go at it. I guess the next step is to find more exported stuff to test, I could only find one.

  • What is it?

    A beta plugin for the Creature animation tool. See here to for more info about Creature:

    http://creature.kestrelmoon.com/index.html

    Download

    https://dl.dropboxusercontent.com/u/542 ... 2d_0.1.zip

    Example

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

    Usage

    1. Set the texture in the editor

    2. Use ajax to load a creature json

    3. when the ajax is done use the "load creature 2d" to load AJAX.LastData

    Notes

    * This is a webgl only plugin. If webgl isn't available for any reason then you won't see anything. I don't think I'll be making a non-webgl renderer since there isn't a way to make it fast.

    * It only has one texture per object type.

    * It currently only plays the "default" Creature animation. This is the main reason for being beta. More features in this area can be added easily and anyone who wants to add actions to do this is welcome to.

  • Paster will be faster with webgl on, but you'll have to paste objects indavidually. With webgl off canvas and paster will perform the same, but canvas lets you paste an entire layer at a time.

  • Not with a shader. The closest you could do right now is using LittleStain's suggestion and paste everything to that every X seconds.

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

  • Try Construct 3

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

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

  • 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