Yann's Recent Forum Activity

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • nope I think you summed up things nicely. Although I think the second one is really what you were looking for.

    What I mean is, in a way, setting an instance variable and putting a distinctive value during edit time (what you call build time) is semantically the same as naming an instance.

    So using a condition to pick this proper instance is, in my opinion, exactly the same as doing a:

    if(instance.name == "black")
    { 
      instance.favorite = true;
    }
    • on touch you store the touch.X in a 'startX' variable
    • while you have your finger on the screen you calculate the offset like touch.X-startX
    • then you scroll the display by this amount

    I did that to mimic a panning by middle clicking+drag.

    It's the exact same idea.

    Panning.capx

  • you have to

    System: Start of layout
    System: Foreach XY element
      -> Array: set value at(Array.CurX,Array.CurY) to random (100)
    Every 1 second
      -> Text: set Text to Array.At(1,1)

    if you don't limit your foreach to a start of layout, it will run each tick, thus reseting your value to another random(100) multiple times each seconds

  • My plugin only map the javascript bitshift function so it's as if you did

    function bitShift(a,b)
    {
      return a<<b;
    }
    
    bitShift(8,3);

    Indeed it can be hard to find some use to bitshifting, but I use it for the isOne, set0 set1 and toggle bit function

    it does respectively

    isOne(value,pos) return return bitfield & (1 << position);
    set0(value,pos) return value | (1 << pos);
    set1(value,pos) return value & ~(1 << pos);
    toggle(value,pos) return value ^ (1 << pos);

    Now as I'm a mere javascript beginner, I can't really say if javascript does bitshifting the fast way.

    This guy seems to say that they are fast

    http://dreaminginjavascript.wordpress.com/2009/02/09/bitwise-byte-foolish/

  • I think the way to use tileset in c2, is to import your tileset via the "import sprite strip..." option and split them accrodingly.

    You can then use animation frame, in the eventuality you want to make Array-based level maps.

    Array.at(10,25) = 2 would mean that you would create a sprite at 10,25 (* cellSize eventually) and it's animation frame would be 2.

  • then change the

    Sprite: is on floor
      ...
      ...
      Keyboard: on down arrow pressed
        -> sprite: set animation to crouch
        -> sprite: set crouching to true

    by

    Sprite: is on floor
      ...
      ...
      Keyboard: down arrow is down
        -> Sprite: set crouching to true
        -> Sprite: set Platform vectorX to 0
        -> Sprite: set Platform vectorY to 0
        -> Sprite: Platform start ignoring control
        trigger once
          -> Sprite: set animation to 'crouch'
    
    Keyboard: [invert] down arrow is down
      -> Sprite set crouching to false
      -> Sprite: Platform stop ignoring control
  • You can only simulate what is handled natively by the behavior. For platform behavior it's jump, move left and move right only.

    If I understand your problem, you want to do something when arrow is down. (crouch?)

    so basically it would be something like:

    Sprite has two instance variable:

    • 'landing' boolean default false //true when landing animation is playing
    • 'crouching' boolean default false // true when crouching animation is playing
    Sprite: Platform is on Floor
      // WHILE on floor doing nothing
      Sprite: [invert] Platform is moving
      Sprite: [invert] is landing
      Sprite: [invert] is crouching
      System: trigger once
         -> Sprite: set animation to 'idle'
    
      // WHEN you start moving
      Sprite: on move
        -> Sprite: set animation to 'walk'
    
      // WHEN you press down arrow
      Keyboard: on Down Arrow key pressed
        -> Sprite: set animation to 'crouch'
        -> Sprite: set crouching to true
    
    //WHILE down is down (you are crouching so you don't move)
    Keyboard: Down Arrow key is down
      -> Sprite: set Platform verctor X to 0
      -> Sprite: set Platform verctor Y to 0
    
    //WHILE down is not down
    Keyboard: [invert] Down Arrow key is down
      -> Sprite: set crouching to false
    
    //WHEN you start jumping
    System: on Jump
      -> Sprite: set animation to 'jump'
    
    //WHEN you start falling
    Sprite: on Fall
      -> Sprite: set animation to 'fall'
    
    //WHEN you start landing
    Sprite: on Landed
      -> Sprite: set animation to 'land'
      -> Sprite: set landing to true
    
    //WHEN you finished landing
    Sprite: on animation 'land' finished
      -> Sprite: set landing to false

    not that these WHILE and WHEN are very important. Either the condition is true during a period (WHILE) either the condition is true just in an instant (WHEN)

    For animation it's important to know if it's a instantaneous or if it lasts, because if a condition lasts you might call an animation every tick, thus only playing the first frame.

    That's why, in the first condition, I added the "trigger once"

    Well. I say that, but I didn't work with character animation for a long time, so there might be some mistakes.

    Also, I might not have answered your question since I got carried away :D

  • for locoroco it seems to be animated sprites.

    for Jelly Cannon it's definitely shape tweening. In c2 it's not that easy to achieve. You can draw some shape on canvas, but interpolating them like that... I don't know. Maybe with a bit of r0j0's magic :D

  • Shock bis

  • oh damn, the crazy guy with levels in layers :D

    hmmm I think in event 12 all the thing you do on layers after the 'Go to layout "Game"&Game_Layout' won't be taken into account after you change layout.

    But I can't help more, you're capx isn't easy to understand

  • If you set the instance variable of a particular instance in the property panel at edit time, each time you reload the layout the instance variable of this object will be reset to this value.

    So if you always want the center cat to be selected on start of layout, you just need to set it at edittime.

    Didn't look at your capx though, but if I understood your post well, all your questions have been answered?

Yann's avatar

Yann

Member since 31 Dec, 2010

Twitter
Yann has 5 followers

Connect with Yann