R0J0hound's Forum Posts

  • Hi,

    Here is a capx that finds the floating chunks. It's probably not the same as your project but maybe some of it would be a useful reference.

    dropbox.com/s/ubx5knq6ulww365/voxel_destroy.capx

    The way it finds the floating chunks is similar to your way. It starts by marking the bottom layer, then visiting each marked and marks their four neighbors. It knows it's done when all the marked have been visited. You then know all the floating blocks are the ones that aren't marked. I utilized an else for that.

    An idea I utilized to make it faster is to use a lookup array with the uids of the objects in a grid. So you can find what immovable block is in a location with lookup.at(int(x/32), int(y/32)). This is much faster than relying on the overlap checks that construct provides with that many objects. A side effect of this is we can make the floating island faster too.

    Another idea to make it render faster is to use a tilemap for all the non moving tiles and just create the movable sprites as needed. The drawback is you'd have to do the floading blocks check in a different way.

    Anyways, maybe you can use some ideas from that capx.

  • Looks good. I like how you can drag them around. I'm not sure why you can't drag number 1 though. Glad it was helpful.

  • I mean you can find the bounding box that surrounds all the sprites, and change the canvas size to that.

    var x0= 10000
    var x1=-10000
    var y0= 10000
    var y1=-10000
    
    for each sprite
    -- set x0 to min(x0, sprite.bboxLeft)
    -- set x1 to max(x1, sprite.bboxRight)
    -- set x0 to min(y0, sprite.bboxTop)
    -- set x0 to max(y1, sprite.bboxBottom)
    
    set canvas size to max(640, abs(x1-x0)), max(480, abs(y1-y0))
    scroll to (x0+x1)/2, (y0+y1)/2

    To pack all the sprites to fill the layout like that you may get good results if you use physics with prevent rotation to try to keep things inside.

  • It basically involves pushing overlapping boxes out of each other repeatedly until they don't overlap. This differs from newts a bit. It more closely matches the gif and runs till they are only slightly overlapping. as a final step you could make the sprites slightly smaller so they won't be in contact at all.

    dropbox.com/s/bcyzlitqf5i6kp0/box_push_out.capx

  • Yeah, that’s correct. You’d just check to see if totalRotation is a multiple of 360.

    Edit:

    Cool. Glad the other suggestion was useful.

  • No, you just have to recreate it in C2 manually.

    The main issue is not all construct classic features are available in construct 2. As well as many things just work different. There is a python library capReader.py that I posted here before that mostly let’s you access all the data in construct classic projects. And I briefly was attempting to utilize that to make a converter, but it determined it wasn’t worth working on further.

    Remaking the project is the only practical way. Especially since you’ll have to do many things differently.

  • Another way to measure the amount the wheel rotated is to use a signed angle difference. It’s like the anglediff(a,b) expression but is negative if counter clockwise.

    angle(0,0,cos(b-a),sin(b-a))

    Will work as long as the rotation is less than 180 in a frame. You could also just use anglediff in this case I suppose since the wheel is rotating only one way.

    TotalRotation=0
    PrevAngle=0
    
    Every tick
    — add angle(0,0,cos(wheel.angle-prevAngle),sin(wheel.angle-prevAngle)) to totalRotation
    — set prevAngle to wheel.angle
  • One way would be to calculate how long three rotations would take from the speed. There’s a general formula rate*time=distance which you can think of as angularSpeed*time=numberOfDegrees. Just solve for time, time=numberOfDegrees/anglulareSpeed.

    Anyways, here’s a possible way to utilize that. It just takes two variables: speed and deceleration.

    On click
    — set speed to 500
    — set deceleration to 0
    — wait 3*360/speed seconds
    — set deceleration to 100
    
    Every tick
    — set speed to max(0, speed-deceleration*dt)
    — wheel: rotate speed*dt degrees clockwise

    You can set speed to whatever you’re doing now to set the speed.

  • Here’s an old example of a way to do it with an array. Json would be pretty similar.

    construct.net/en/forum/construct-2/how-do-i-18/replay-meatboy-55099

  • Soft body physics for things such as jello are always cool to mess with. Every so often I try to find ways to do it better. Typically they are done with a grid of points connected by springs. The only downside is they can collapse on themselves sometimes. But the following corrects that by having it try to keep the same area from one frame to the next. The result a very robust simulation that doesn't break.

    Here is an example using the paster addon, and one without 3rd party plugins that doesn't distort images.

    dropbox.com/s/ikcd3sxj9eowomg/jello_paster.capx

    dropbox.com/s/zj51hzstahv0f8n/jello_no3rdParty.capx

    dropbox.com/s/ray56gskqwpiwfy/jello_c3.c3p

    Edit: ported to c3 as well. It fit within 25 events.

    Cool reference:

    matthias-research.github.io/pages/tenMinutePhysics/index.html

  • This post is relevant:

    construct.net/en/forum/construct-3/general-discussion-7/coeficient-accept-more-167339

    It can go from 0 to infinity according to the box2d manual.

  • Not sure if it’s intentional, but once it deforms too much it takes on clay like properties which is pretty cool in its own right.

  • You do not have permission to view this post

  • Wouldn’t using the action:

    Set css style "transform" to "rotate(90deg)" work?

    Seems to be supported on most browsers.

    caniuse.com

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I think when an action takes an object as a parameter it's not picky what kind of object.

    Form objects actually float above the game canvas so they don't draw. I think the only workaround for that is to somehow draw the form controls on the canvas. You can do that by setting css opacity to 0 and doing the drawing by other means. However, there seems to be quite a bit of nuance to draw the same.

    Here's a test of hiding the inputbox form and displaying it by other means. Needs work when more text is displayed, but it may give ideas.

    dropbox.com/s/5xygyt0uo5zyz96/hidden_input_form.capx

    A simple solution would be to limit the number of characters?