R0J0hound's Recent Forum Activity

  • I don’t think there is any plugin that would help.

    My current idea is to use the physics behavior for the bubbles. Then just apply a force from every bubble to every other bubble to have them go together. They will just be rigid circles though, not soft.

    To make them soft the idea is to draw a larger circle around the bubbles and everywhere those larger bubbles overlap it would become flat. Easier said than done, I have a few ideas but they are involved and I’d have to actually try it out to see if it looks good.

    The circle outline could be done as a bunch of sprites as line segments. Filling these outlines could be done by triangulating the polygon shape and then placing two right triangle sprites to fill each triangle.

    As is construct 2 doesn’t have the drawing features we want. Namely drawing lines and polygons.

    There’s a few plugins that can help do that:

    Canvas- has drawline and polygon drawing

    Polygon- has polygon

    Paster- has draw quad

    Custom draw- has draw quad

    C3 has only the built in canvas plugin. I’m pretty sure you can draw at least filled polygons with it.

  • Here’s a few ideas.

    The first is to to make the L shape out of a single object so it’s easy to move and rotate. Then when it lands you create the smaller squares on top of the shape, and then destroy the shape. You could utilize image points to mark where to create the smaller sprites.

    Another idea is to have another hidden object to act as the rotation center and use the pin behavior to attach the squares. Delays of when the behavior runs may or may not be an issue.

    A third idea is a more manual method. First you create the squares in the shape you want, and probably use an instance variable to help with picking just them and then rotate them with this equation:

    Set position to (self.x-centerx)*cos(90)-(self.y-centery)*sin(90)+centerx, (self.x-centerx)*sin(90)+(self.y-centery)*cos(90)+centery

    Where centerx, centery is the position to rotate around and 90 is how much to rotate.

  • The -180 to 180 range is caused by the math function used to calculate the angle. Namely atan. Radians don’t effect that.

    Probably a good rule of thumb is any angle that is calculated will be in the -180 to 180 (or normalized angle) range, and any angle you set will just keep that value or make it in the 0-360 range. So even though you can set the angle of motion, it’s something the behavior can change so it’s calculated.

    Usually when comparing angles it’s best to just use the angle comparison system conditions. With them it sees things like 270 and -90 as the same.

  • Not easily I think, then again it’s probably not too easy no matter what you use.

    What I see are distorted spheres overlapping each other. I don’t know how you’d do that without 3D.

    You could try just drawing outlines with a bunch of sprites and make it flat between circles. That would likely require a lot of calculations.

    You can’t really draw filled polygons so coloring the bubbles isn’t really feasible.

    The motion could be done with physics pulling the bubbles toward each other. The soft body nature looks to be secondary.

    In short I don’t think construct has the tools to help do it as is. You’ll probably have to do it with a custom Plugin or something.

  • So the issues are the textBox isn't long enough and the text isn't being centered vertically?

    The width should be simple enough. For fixed width fonts like spritefonts it would be len(text)*characterWidth. For normal text objects there is a textWidth expression, but it only gives the width of the previous frame (booo!). You could also do word warping. I think this is handled by the object, but I haven't checked.

    Vertical centering is just a matter of moving things up and down. So if you know you have two lines you can leave things as they are, and if you have only one line you can move the line down by half a the height of a letter to center it. You may also be able to utilize the vertical alignment property.

    There is an issue if you use lines of dialog with newlines, you'd have to look at the width of each line and use the longest one for the width. Here's it in pseudocode:

    var width = 0
    var height = 0
    repeat tokencount(dialog, newline) times
    -- set width to max(width, len(tokenat(dialog, loopindex, newline)*characterWidth)
    -- add characterHeight to height
  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • The math for motion can be done per axis which helps simplify things.

    We can just pick one axis as an example. You can do other axis in the same way.

    x is the position, and vx is the velocity.

    Constant speed:

    x = x + vx*dt

    acceleration:

    vx = vx + 100*dt //100 is the acceration

    x = x + vx*dt

    So for a mario style example you could do x with constant speed and y with acceration. Then to jump you'd set vy to -200 or something.

    On space pressed
    -- set vy -200

    You could also just apply the vy the while the button is pressed. Just use a timer too so you'd only set the velocity for so long.

    xyz stuff is mostly a matter of mapping the third axis onto xy.

  • Sorry, I won't be porting them to C3. C3 does seem to have it's own canvas plugin though. Maybe you could open the example in C2 as a reference and see if you can utilize the C3 canvas plugin to do the same thing.

    I haven't really used C3 to give a better idea.

  • Does these files work with C3? I downloaded them but couldn't install it to my C3 Project.

    Thanks

    Naw. They only work with C2.

  • It's always been fuzzy to me, so I had a look at the runtime source in C2. C3 is probably very similar, since if they changed it it would be a breaking change.

    It seems that the it picks the default instance by going through the layouts in order they are in the project, and then the layers in order and the instance with the lowest uid becomes the default.

    I didn't look too much further but another thing to test is the order of the layers. Are they defined by their order in the editor or the order they were added? I'm guessing just their order. I have no idea if global layers mess things up. I think the layout order is the most useful thing to know.

    Anyways, from that it seems that a nice strategy to control default instances is to create a new layout and add one instance of each object. Then drag that layout to the top of the layout list. Be sure to set the initial layout in the project properties.

    Thanks for the interesting question, it revealed something useful I didn't know before.

  • nelostic

    There are two things:

    collision groups. When two instances are in the same group they won't collide. It's just a number.

    Collision layers. It's a series of 1's and 0's, one for each 32 layers. Two objects will only collide if they share a one in the same position.

    the Mnk

    It adds collision filtering, and a lot more joints as well as other improvements, as well as various differences.

  • TeamOne

    Naw, just here.

  • You mean like the platform behavior just with events instead?

    It's basically called parabolic motion, and you could use the bullet behavior with gravity if you wanted.

    Anyways to do it with just events you'd add two instance variables to the sprite : (vx and vy). Those would be the horizontal and vertical velocities. Then the event would be:

    every tick
    -- sprite: add 100*dt to vy
    -- sprite: set position to self.x+self.vy*dt, self.y+self.vy*dt

    I can't really think of a application of lerp or clamp with just that.

    You could clamp the vertical velocity so that it doesn't fall too fast?

    set vy to clamp(vy, -100, 100)

    I may have bungled the order of the parameters though.

    You could limit the y position for some kind of ground too:

    set y to min(self.y, 400)

R0J0hound's avatar

R0J0hound

Member since 15 Jun, 2009

Twitter
R0J0hound has 156 followers

Connect with R0J0hound