R0J0hound's Forum Posts

  • fldr

    It's more efficient to use for each boulder since it only checks the spaces around the boulders. The only reason to use a tilemap instead is perhaps faster rendering. For that you could make all the sprites invisible and update the tilemap as things are moved.

  • Rable

    The issue is with the "push out solids" behavior. Well, it's to do with what's builtin to C2 since the behavior does the same thing as the "push out" action of the custom movement behavior.

    I've always just opted to implement the push out myself. Here's one example:

  • You'll still need the "for each", but you can replace walls with any other sprite or family.

  • You mean like wall sliding? If you're interested in an event based solution, here is one which is basically an improved "push out" that treats the player as a circle:

    EDIT:

    I posted before your edit. Yeah that would be useful if included in 8-dir.

  • jogosgratispro

  • It's only openable in construct classic. I don't have access to it right now to take a pic. Have you tried searching the forum for laser? There are capx examples that are similar.

  • If you're using the on collision event you specify the type to check for collision with, so you could use the angle() expression. Just use the other object type instead of other.

    Or if you make a family, call it other, and then use an event like this:

    Sprite: on collision with other

    That way you can use your expression exactly. Also this is the recommended way to handle collisions between two objects of the same type.

  • To do any 3d scaling like that you need to take into account z position.

    when z=1 then the object is at the screen, if z=0 then it's at your eye. Usually you want to destroy/hide the object before reaching the eye.

    Consider this example:

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

    I just drew up some simple graphics. I placed the road so it disappears at a vanishing point (320,240).

    I then placed the "building" sprites on either side of the road where I'd want them to be if they were at the screen. I then resized them so the edges match the edge of the road.

    Looking at just the right "building" it has a position of (556,426) and a size of (161,105).

    Next is the math part. We want it to move and scale as the z changes.

    Set position to ((556-320)/z+320 ,(426-240)/z+240)

    Set size to (161/z, 105/z)

    In the above equations 320 and 240 is the vanishing point,

    556 and 426 is the object's original position,

    and 161 and 105 is the original size.

    z is how far into the screen you want the object to be.

    Z sorting can be done with something simple like:

    for each sprite ordered by sprite.z ascending

    --- sprite: move to back

    Collision detection can be done by seeing if the z is in range of the other's z:

    sprite: on collision with building

    building: z > sprite.z-0.01

    building: z < sprite.z+0.01

    --- destroy sprite

  • add a start of layout condition to the for event. Events are run top down every frame so the "for" would be run every frame.

  • You can delete it if you like. I used it to limit how far the wheel can rotate.

  • There is no capx. This was for Construct Classic, but the cap file link still works.

  • mattb

    The way I look at it the angles of the two gears are related like this:

    gearB.angle = (gearA.angle-gearA.initialAngle)*ratio + gearB.initialAngle

    So when gearA.angle is zero gearB.angle is:

    = -gear.InitialAngle*ratio + gearB.initialAngle

    Make that negative and we get the phase:

    phase = gear.initialAngle*ratio-gearB.initialAngle

    Ok, to simplify the angle calculations make sure the angle of every gear is between 0 and 180 degrees. Then using the following makes rotations spot on in your capx:

    phase = -gear.Angle+fGear.n/Gear.n*-fgear.Angle

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You could also utilize the "pick by comparison" with the distance expression. So if the tiles are 32x32 pick the tiles that are less than 33 pixels away. 1 extra pixel to account for float.

    Global number iid=0

    On Sprite clicked

    set iid to Sprite.iid

    On Sprite clicked

    Pick all Sprite

    Pick Sprite by comparison: distance(Sprite.x,Sprite.y,sprite(iid).x,sprite(iid).y) <=33

    [Negate] pick Sprite by uid sprite(iid).uid

    Sprite: set animation frame to 2

  • The editor is made in c++ with OpenGL to draw stuff. JavaScript is also used to for the plugins to communicate with the editor. When you run or export your project it's all html5 and JavaScript.

  • The idea is just to create them all and hide them as needed.

    The for loop to create the squares can be done once in a start of layout event. The for each ordered can be done once right after all the squares are created to define the order they get shown. You can then do the hiding with the first two events in my previous post. "Health" was the example variable that the squares represent.