R0J0hound's Forum Posts

  • turn off gravity by setting it to 0.

  • You could try doing it with the physics behavior, since you wan the object to have momentum. Just apply forces to move the ball around.

  • There is nothing in place to help with that. With the physics behavior the shapes need to be defined in the editor before the game is run. You could use the canvas or paster plugins to draw the object though.

    One idea could be to build the shapes out of a bunch of simpler objects and join them together with joints, but that does have some issues. Namely objects joined together with joints behave a bit spongy.

    A better solution is to work with the physics engine at a lower level using javascript, although you can't really do this along with the physics behavior. More on this in a moment.

    The basic flow of your game would be to:

    1. when you draw the shape a list of points is made.

    2. Those points make up a polygon. This needs to be converted to a list of triangles or at least convex polygons. This is mainly for the physics engines which generally don't work with concave polygons.

    3. find the center of mass by averaging the point locations.

    4. create the physics object with that shape.

    That may vary depending on what a given physics engine does for you.

    Here's one possible example of using javascript to access a physics engine instead of using the behavior:

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

    /5426011/examples34/jsPhysics.capx

    On another note you did say simple objects. You probably could use some gesture recognition to see if the object is close to a circle, square or triangle. Then add a sprite with that shape and size and orient it to approximately match the area drawn. The gesture recognition is something a plugin may be able to help you with, or maybe even some other capx on the forum.

  • Looks like a nice thing to have. But what I really miss is the ctrl+c and ctrl+v on events like in old Construct Classic.

    How do you mean? They are working for me in C2.

  • Instead of atan2(y,x) use angle(0,0,X,y).

  • It probably will have the same performance.

  • I'd say don't generate the whole level at once. Generate what's immediately on screen and then progressively generate the rest of it. The idea is to make it so the impact on the framerate is negligible. You could also generate the next level when the current level is done loading. There's probable a lot of ways to go about it.

    Actually doing parallel coding will require using javascript and even then it's not so simple.

    The mouse wheel button is the middle mouse button.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • One way is to check for collisions between positions like one of these:

    Another idea that i can't find an example for is to stretch a rectangle sprite from the old position to the new. Then if it collides you then can back the object up.

  • TimeMachine

    It should, i've never tested it. You could try turning webgl off in the project properties because this plugin doesn't perform well with webgl. Maybe that will correct something. Other than that it uses an html5 canvas internally which should just work on any html5 export.

  • In that example I just made the lines overlap a bit. It works well for wide angles, but won't look as good for sharper ones.

  • For the first image it looks like you could do it with a bunch of sprite pieces. It could be tedious to place by hand. Using a tilemap would work if the tiles match up when placed on a grid. At first glance that tile set doesn't look like it would.

    For the second image there are two parts to it: making something look like that and collisions. You could use the canvas object to draw stuff like that. The paster object could also do it using the draw quad action, although it would take some math to position the corners.

    For collisions you could stretch a rectangular Sprite to make a line, although the corners would need more work to do.

  • The canvas plugin is slow when webgl is on.

    With paster you can make a line with a quad, but it's easier to paste a sprite positioned like a line.

    Both plugins are just something you can draw to. To be able to remove indavidual lines you need each line to be it's own object, and you can do that with sprites.

  • Nice.

    Javascript uses doubles for numbers, which has a max integer value of 9007199254740992.

    So that would mean if you created a million new sprites every tick, uid's would overflow after a bit longer than 4 years of continuously running at 60fps.

    Construct2 also does object recycling so it doesn't cause javascipt's garbage collector to have to work as much.

    I had another go at it here:

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

    It take any polygon with a clockwise vertex winding, without self intersections and converts it to triangles. One issue is there are seams between the triangles which should be correctable by scaling the triangles up sightly from their centers, but I've been having trouble getting perfect results.

    The simplest way would be to just draw a polygon with the canvas, but as I mentioned before, it will have a performance hit with webgl on. With the paster object you'll need to triangulate the polygon, but since it draws quads it can be more efficient if merge adjacent triangles to make it mostly quads.

    Both canvas and paster handle blending modes fine since they are just images. Also they only have bounding box collisions.

  • It's a bit off topic, but I find "Wait 0 seconds" to be a hacky solution in most cases. It's used in cases where new objects aren't pickable yet and when used multiple times it makes the game logic very hard to debug.