R0J0hound's Forum Posts

  • I can't open the capx now, but since you say breakout I'm guessing you'll only have unrotated rectangles that the ball bounces against.

    One way to do it is to move the ball backwards when it collides with a block, which can be done with the push out of solid action of custom movement. Then you can use dom's idea to find what direction walls are.

    Bouncing off horizontal and vertical walls is just a matter of reversing the y or x velocity of the object. You can also calculate the bounce angle if you know the angle of the wall hit but I don't recall the formula off hand.

  • One approach I've used in the past is create enough tiles to cover the screen and create no more. I then used a large array to store the generated level and hide and disable solid for eny empty tiles onscreen. When you scroll around as normal the tiles that move offscreen are then moved to the other side and updated from the array.

    Another idea could be to use the tilemap object if it's acceptable to have edges.

  • Good catch with the parenthesis, multiplication and division are done left to right. I think I learned about that in basic algebra.

    It's slow because between the .asJSON expression and loading it into an array it's a slow operation. I haven't really seen a way to make it faster.

    There are two asJSON expressions because all objects have that expression to get a json version of their state. For canvas object they both do the same thing.

  • Instead of loopindex I used Sprite.Count-1 to set the animation frame. I could just as well have used sprite.iid though. Would that work? I don't see the need for loopindex.

  • Instead of a loop just compare the object count.

  • You can look here for stats on it:

    http://webglstats.com/

    For computers that support webgl 100% of them support 2048, hence that recommended limit. Looking at the graph you can use bigger textures but it won't work on all computers.

    On a side note if you don't use webgl, eg turn webgl to off in the project settings you can have much larger images, but I couldn't find any info on the upper limits. The limits seem to be based on if there's enough video memory and if you run into graphics card limits, it just varies on how the canvas is implemented in the browser.

  • Here's a bit of info about the .asJson expression for the canvas:

    And here's how to do it:

    global number pixelCount = 0

    global number percentClear = 0

    every 1.0 seconds

    --- array: load from canvas.asJSON

    --- set pixelCount to 0

    ------ repeat canvas.width*canvas.height times

    ------ Array at (0,0,loopindex*4+3) = 0

    --------- add 1 to pixelCount

    --- set percentClear to pixelCount/canvas.width*canvas.height

    In the array comparison instead of checking if the alpha is 0 you could for instance use <128 to count any pixel less than 50% trasparent.

  • striimix

    I can't reproduce it. Can you provide a capx that gives that error?

    spongehammer

    That's just a case of over aggressive sleeping. Disabling sleeping fixes it. Although it is odd that size has anything to do with it.

    Prominent

    You shouldn't need to use dt anywhere. A fixed timestep of 1/30 is the timestep used per frame. So if the game is running at 60fps then after 60 frames the physics will be 2 seconds along compared to the actual 1 second.

    You can specify a variable timestep but that isn't so good with physics, so a fixed timestep is recommended. The drawback is the physics can run faster/slower depending on the screen refresh rate, aka it's not framerate independent. That said you could detect the fps of the game when it starts and set the timestep based on that.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • One thing you could try is make the player lighter and/or increase the iterations of the simulation. Also it would just pull apart if the platform behavior is used.

  • Yeah you'd want to use a joint to attach the player to the rope. The main issue you'll run into is the platform behavior and physics clash so it may be simpler to just move the player around with just physics.

  • Look at "go faster" on the arcade for one idea. It even comes with a capx you can look at. The auto runner template that comes with C2 is another.

    Basically whatever kind of level generation you can implement can then have a player inserted into with even the most basic movement.

  • Here's one way. Find the angle from the point to all the corners of the sprite and then only keep the more clockwise and counter-clockwise angle. The difference of the angles is then the subtended angle.

  • You could use a gear joint to lock the knee at a fixed angle.

    "ratio" should be 1 and "phase" should be the angle you want the knee to be.

    After creating the gear joint you can adjust the phase with the "set joint properties" action.

    For raising the leg you could use a torque or a motor joint perhaps, since that's how creatures move their limbs.

  • The process is basically the same as the other physics examples, add joints between all the sections of rope you want to join.

  • Colludium

    That polygon is concave. The physics behavior breaks concave polygons into multiple convex ones internally. The reason it works is none of those convex polygons likely have more than 8 points, or 16 starting with release 198. The limit is likely an optimization, but instead of giving an error it would be nice if convex polygons with more than 8 points were just split into multiple to allow users to not worry about it.