R0J0hound's Recent Forum Activity

  • Point2.x=dist*cos(ang) +point1.x

    Point2.y=dist*sin(ang) +point1.y

  • You could do it with a layer. Set it's property "force own texture" to true, then place all your obsticle objects on it to build up the terrain. They just need to be a solid color and you build up a complex terrain by placing a bunch of simpler shapes. Then to finish it off add your tiledbg to the layer, make sure it's the top object in the layer and set it's blend mode to "source in".

  • I don't have access to C2 atm but the reason a pinned object is lagging behind the object it's pinned to is a order issue. Generally you don't have much control over it. You could try to change the order of the behaviors in the object. As I recall the pin behavior is run after the other behaviors so rearranging may not do anything.

    Anyways my solution of choice would be to position objects with events instead of using the pin behavior. This gives you full control of what happens. There are a few ways to do this. This simplest is to add imagepoints on the parent object that you'd position the child objects to. Another is to store the X,y or angle,distance offsets from the parent object.

  • [quote:2rzyicbc]If that is the case how do I go comparing a value that has *dt to a value that doesn't have *dt?

    For example:

    If Speed>100*dt

    Using dt there doesn't make sense. Speed should be the same regardless of dt. With that if the fps is 60 the comparison is speed<1.66, but if the fps drops to 50 then it will be speed<2.

    "dt" should only be used where it's needed, and it's only needed in cases where you want to know how much a value will change in a length of time if it's going at a certain rate. Or more simply in equation form:

    rate*time = amount

    Some examples:

    You want a object to move 100 pixels per second:

    x = x+ 100*dt

    you want an object to rotate 30 degrees per second:

    angle= angle+ 30*dt

    you want a speed to accelerate by 10 pixels/sec^2.

    speed = speed + 10*dt

  • [quote:2ywusg04]EDIT: I've figured out, when you don't have 1 pixel blank space on your sprite this will happen.

    Sounds like texture bleeding from the exported spritesheet. It's a pretty common thing with graphics rendering on computers, and a one pixel border is usually the best solution.

  • 1.

    The pixi.js renderer on the github repository was the most helpful in making the renderer work. As far as I understand it is as long as you choose the json export you can load it with this plugin.

    2.

    The way it works is the animations need to be loaded and then it's a simple matter of setting the animation. When I get around to it it can be made to load all the animations from a file and then the current animation, speed of animation and position in the animation can be changed.

    3.

    "CreatureMeshBone.js" is the meat of the plugin, which made it fairly easy to get working. It does have a feature to blend from one animation to another and you can specify the blend factor from 0 to 1, where 0 is the first animation and 1 would be the second. Any value in between like 0.5 would be a blend of the two. When I get around to it I can implement it, but it would be nice to have an example with more than one animation to test.

    4.

    It is, I just forgot to uncomment a line in the code. Not sure if the result is very pleasing to the eye.

    The loading jank is kind of unavoidable, not sure if I can make it asynchronous, but it would be an idea to explore.

  • locohost

    yep.

  • MrShortee

    Good to know. Fixed.

  • 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

  • Try Construct 3

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

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