Yann's Forum Posts

  • nope only you :D

    hehe kidding. That's a nice example

    I would probably make an animation of the turning page.

    As it's always the same (would be a bit heavy though)

    Maybe it could be done by horizontal stretching of a vertically stretched 1px height sprite gradient starting from width = 0 to width = pageWidth during the horizontal movement.

    Also scaling up height a bit and then down for faking perspective.

    For the rest it's just some frame on corresponding thumbnail and some fading effects

  • First checking between two instances is a pain because of picking.

    Also it can be pretty cpu intensive if you have many instances because you will have to check instance.count * instance.count times

    But anyway it can be done with picking ID like :

    distance(sprite(0).x,sprite(0).y,sprite(1).x,sprite(1).y)[/code:2dvpkpb2]
    So I guess for distance checking it would look like
    Sprite has two instance variable :
    [ul]
    	[li]closest   //will hold the UID of the closest instance[/li]
    	[li]dist      // will hold the distance of the instance matching the UID[/li]
    [/ul][code:2dvpkpb2]System: for "first" from 0 to sprite.Count-1
       System: for "second" from 0 to sprite.Count-1
       System: Pick Sprite instance loopindex("first")
          Local variable tmpDist = 0 //for clarity
          -> System: set tmpDist to distance(sprite(loopindex("first").X,sprite.(loopindex("first").Y,sprite(loopindex("second").X,sprite.(loopindex("second").Y)
          // Check if closer
          System: Sprite(loopindex("first").dist > tmpDist
             -> Sprite: set closest to Sprite(loopindex("second)).UID
             -> Sprite: set dist to tmpDist
          // Only happen at first check
          System: loopindex("second") = 0
             -> Sprite: set closest to Sprite(loopindex("second)).UID
             -> Sprite: set dist to tmpDist[/code:2dvpkpb2]
    You should get the UID of the closest instance of each sprite to each other in the sprite.closest  instance variable.
  • Hi guys

    I made a little plugin a while ago to do bitwise operation like

    12 AND 9 = 8
    12 OR  9 = 13
    12 XOR 9 = 5
    NOT 9    = -10
    12 <<  2 = 48
    12 >>  2 = 3[/code:36oad0vt]
    
    And some condition to check if a number is power of 2 and if some bitfield match a mask. Stuff like that.
    
    if you have any question about this WTFness please, brace yourself and read that first
    [url=https://developer.mozilla.org/en/JavaScript/Reference/Operators/Bitwise_Operators]https://developer.mozilla.org/en/JavaSc ... _Operators[/url]
    
    The plugin is here:
    [url=https://app.box.com/s/hfxd0q90mwmv8fbsod0e]Bit.zip[/url]
    
    #### Conditions ####
      Check
        - Check Mask
        - Is bit set to 1
        - Is power of 2
    
    #### Actions ####
    NONE
    
    #### Expressions ####
      Manipulation
        - set0
        - set1
        - toggle
      One Operand
        - Not
      Shifting
        - lShift
        - rShift
      Two Operand (ok I forgot the '-s')
        - AND
        - OR
        - XOR
    
    And that's all <img src="{SMILIES_PATH}/icon_e_biggrin.gif" alt=":D" title="Very Happy">
    
    feedbacks are taken into accound from 18h30 to 18h35 GMT+1 (gneheheh)
    
    It was a joke �_�
  • And we would be glad to accept :D ... But that might start an answering war (money... wars... always associated).

    Don't worry helping is learning.

  • I tested your capx with and without pixel rounding on firefox8.0 (should update) and chrome and there were no issue with your non rotated tiledbg

    But indeed as soon as you rotate it, you can see the seam appear. I think it's logical, the graphic engine have to find a way to display oblique lines and that might cross the seam.

    For this specific problem, there's a simple workaround: flip your image vertically and make your tiledbg height slightly lower. That should do the trick

  • like that shapeMatching.capx

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • or use the choose() function

    Audio: Play choose("bird","duck","cat","tiger") from Sounds (tag "animal")
  • counting.capx

    First... Using "On Frame Changed is weird" I would place the increment directly in the "On Collision event"

    Also, for your bug, you just had to put the animation speed to 0 (when you edit animation you have animation speed in the property panel)

    If you have some speed in your animation, even with one frame you will trigger the "On Frame Changed" on start of layout.

    And I guess you will trigger it twice when switching animation.

    Well... Now it works as you intended I think.

  • show capx (:

    hmmm... Chocapics?

  • Well... You answered your own question :D

    "altering the platform behaviour speed by comparing the current value of the global variable"

    Sounds good to me

  • If we ask mister Physic, he will talk about kinetic energy (Ek)

    Ek = 1/2 *mass*speed^2

    So what you would want to know is what is the Ek applied to an object.

    And based on it's fragility (which could be an instance variable) you could break it or not.

    Well fragility... It could really be just Hit Point. This way you can hit the same object many times until it break.

    Also, the mass would be another instance variable.

    So we just need to know the speed of the first object relatively to the other one.

    Well wait a minute

    obj1 has an Ek1 ->   Energy impact = Ek1+Ek2   <- obj2 has is own Ek2

    well it's true only for a frontal impact.

    So how to evaluate non frontal impact?

    You probably have to project the velocity vector of obj1 onto the velocity vector of obj2

    Yeah I guess it would be like that:

    Sprite1: On Collision with Sprite2
       Local Variable v1X  // Sprite1.Physics.VelocityX (for simplification)
       Local Variable v1Y  // same
       Local Variable v2X  // same
       Local Variable V2Y  // same
       Local Variable v1   // Sprite1 velocity projected to Sprite2 velocity
       Local Variable v2   // Sprite2 velocity
       Local Variable ECollision //Energy generated by the collision
       //Simplification
       -> System: Set v1X to Sprite1.Physics.VelocityX
       -> System: Set v1Y to Sprite1.Physics.VelocityY
       -> System: Set v2X to Sprite2.Physics.VelocityX
       -> System: Set v2Y to Sprite2.Physics.VelocityY
       //we get (more or less) the Magnitude of the vector (v1X,v1Y) projected on v2
       -> System: Set v1 to -cos(angle(0,0,v2X,v2Y)-angle(0,0,v1X,v1Y))*distance(0,0,v1X,v1Y)
       //Magnitude of the vector (v2X,v2Y) (actual speed)
       -> System: Set v2 to distance(0,0,v2X,v2Y)
       //Energy of the collision
       -> System: Set ECollision to 0.5*Sprite1.mass*v1^2 + 0.5*Sprite2.mass*v2^2

    Then you just have to use the value of ECollision as a Damage value. Decreasing HP of your sprites and breaking them if it's too high.

    This calculation should also work if obj2 try to move away from obj1, the damage should be less than if obj1 is immobile.

  • depend what kind of menu. Maybe you can have some sprites pinned to a main one and you put it one screen when you want to show it up, and offscreen when you want to hide it.

    Make some basic drawing, show us what you want. Also it would be cool if you try your hand on c2 directly. There's no better teaching than the trial and error. Also check out related and unrelated tutos... good teaching too.

  • The PIE is a LIE!

  • There's a layoutname system variable

  • nah it's far simpler than that.

    Snapping is a kind of value rounding. For instance if your round off float value, you obtain a snapping to exactly 1 px.

    To achieve the same kind of effect with wider cells you just have to scale down values, round them up and scale them back up.

    That's the idea.

    Mathematically it looks like that :

    System: Every Tick
       -> Sprite: set X to round(mouse.X/cellsize)*cellsize
       -> Sprite: set Y to round(mouse.Y/cellsize)*cellsize[/code:1sjnyoii]
    now you might end up with some offset depending on either:
    1. the position of the pivot point of your sprite
    Or
    2. the starting position or origin of your grid
    
    for the first one you just have to add a position offset to the result
    [code:1sjnyoii]System: Every Tick
       -> Sprite: set X to round(mouse.X/cellsize)*cellsize+Sprite.pivotOffsetX
       -> Sprite: set Y to round(mouse.Y/cellsize)*cellsize+Sprite.pivotOffsetY[/code:1sjnyoii]
    for the second you have to offset the position before calculation and then offset it back (its like a change of origin)
    [code:1sjnyoii]System: Every Tick
       -> Sprite: set X to round((mouse.X-gridOffsetX)/cellsize)*cellsize+gridOffsetX
       -> Sprite: set Y to round((mouse.Y-gridOffsetY)/cellsize)*cellsize+gridOffsetY[/code:1sjnyoii]
    
    I hope I'm not too wrong