R0J0hound's Recent Forum Activity

  • A little bit of info:

    System: abs(player.x-enemy.x) < distance

    That only compares the first picked "player" and "enemy" objects' values.

    foreach enemy
    System: abs(player.x-enemy.x) < distance

    This compares each enemy against the first picked instance of the player.

    enemy: abs(player.x-enemy.x) < distance

    Now the "pick by comparison" that CC has is like the "system compare" with these differences:

    1. Corresponding picked instances are used for expression values.

    ex:

    The first picked enemy is compared with the first picked player,

    the second with the second,

    the third with the third... and so forth.

    If the amount of picked objects differ in count for example: 2 players and 4 enemies it will loop back to the first.

    ex:

    The first picked enemy is compared with the first picked player,

    the second with the second,

    the third with the first,

    and the fourth with the second.

    2. The enemy objects are picked.

    I'd also like to point out these apply to picking in general with most object conditions.

    Now for the workarounds until "pick by comparison" is added.

    Since I assume there will be one player and many enemies Yann's second solution will work fine. I've also used private variables to do the same thing:

    Every Tick-> enemy: set dist to abs(player.x-enemy.x)

    enemy: dist < distance -> do stuff

  • It's done just as you describe. Give the player and obstacles the physics behavior, and apply forces to the player to make him move.

    http://dl.dropbox.com/u/5426011/examples%208/physics_plat.capx

  • Until it is properly implemented as a condition you can do it yourself with events.

    <img src="http://dl.dropbox.com/u/5426011/examples%208/pick_topmost.png" border="0" />

  • You don't have to use matrices, just some trig will work. The hardest bit is probably the depth sorting.

    /examples%208/carousel.capx

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

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • None of those errors are related to c2. The relevant error would be at the bottom of the list, but if there was an error the level would be grey not white. Did you add anything to your new layout? C2 previews on the currently selected layout, so if you didn't add anything you will just see an empty white layout.

  • Sprite2's position is not being repositioned in your repeat loop so when it overlaps with the wall it overlaps through the entire loop, moving 20 pixels. To fix it put a action to position Sprite2 to Sprite in the loop.

  • It works if you put your events in the same order as it is in my post. Events are evaluated from the top down.

  • Give the wagon two variables "oldx" and "oldy", then the events are as follows:

    + System: Start of layout

    -> wagon: Set 'oldx' to .X

    -> wagon: Set 'oldy' to .Y

    + Sprite: Sprite overlaps wagon

    -> Sprite: Set position to .X+wagon.X-wagon('oldx'), .Y+wagon.Y-wagon('oldy')

    + System: Always (every tick)

    -> wagon: Set 'oldx' to .X

    -> wagon: Set 'oldy' to .Y

  • The speed can be calculated with:

    sqrt(Sprite('vx')^2 + Sprite('vy')^2)

    or with physics:

    sqrt(Sprite[Physics].VelocityX^2 + Sprite[Physics].VelocityY^2)

    Height is just the distance from the bottom of the screen:

    480-Sprite.Y

    Here are some resources:

    physicsclassroom.com/class/vectors

    en.wikipedia.org/wiki/Kinematics

    en.wikipedia.org/wiki/Projectile_motion

    en.wikipedia.org/wiki/Trajectory_of_a_projectile

    en.wikipedia.org/wiki/Euler_method

  • Move the sprite 1 pixel down, check for overlap with ground then move the sprite back up.

    every tick:

    ----Sprite| set isInAir to true

    ----Sprite| set Y: y+1

    Sprite| is overlapping ground:

    ----Sprite| set isInAir to false

    every tick:

    ----Sprite| set Y: y-1

  • Here is a working example:

    http://dl.dropbox.com/u/5426011/examples%208/projectle_drag.cap

    But since you said you're new to physics I'd recommend using the physics behavior which will take care of most of the calculations for you.

    http://dl.dropbox.com/u/5426011/examples%208/drag_with_physics.cap

    A few notes:

    Set linear damping to 0%.

    Set the world scale x and y to 3.125% for 32 pixels to be 1 meter.

    The mass property is actually the object density in kg/m^3.

    You already have the formula to calculate the drag force, just apply it to the object in the opposite direction as it's motion.

  • Can't the array object be used just like that?

    Set the size to say (100, 2) for one hundred pairs of numbers.

    (n, 0) would be the x's and

    (n, 1) would be the y's.

    Ex:

    -+For each sprite

    ->Sprite set x to ArrayAt(loopindex, 0)

    ->Sprite set y to ArrayAt(loopindex, 1)

    And if you later want an angle to be included set the array size to (100, 3) and (n, 2) would be the angles.

R0J0hound's avatar

R0J0hound

Member since 15 Jun, 2009

Twitter
R0J0hound has 155 followers

Connect with R0J0hound