Yann's Forum Posts

  • just the angle between the mouse and the character

    angle(character.X,character.Y,mouse.x,mouse.y)

    you plug that in the formula above and that should do the trick

  • oh! right click ok

    nice (:... maybe the moon should go behind the text 'cause it's pretty close in values and it blends a bit too much with the title. So either way from the center, either a bit darker (:

  • the mask should be in destination-out and your layer should be set to force own texture = yes

    Also, don't do it in the first layer. You'll dig a hole in the canvas and see the grey behind it :D

  • RicardLF

    You can also describe a basic IA algorithm and some people used to fiddle with c2 could tell you if it's easily doable or not by event or if you should create a plugin (the might even provide an implementation example).

    Anyway, IA shouldn't be an issue with C2. Saving and loading stuff seems to me more problematic than that.

    Also Kyat did a behavior plugin for pathfinding. And I think pathfinding is a basic form of game AI. So yeah... pretty doable.

    And even if you are skilled programmers, you should start with some basic tutorials. Because even if in my point of view, C2 is a form of programming, it is very unsettling for those used to scripting.

    By the way smitchell's answer made me think of a water simulation I did on construct classic. I could do the same with c2, it's just a bit hard on CPU.

    waterSim.exe

    It was just an algo I found on the net (it was written in java) and I adaptated it.

    Did the same for a maze generator from a ruby algo

  • System -> Create

  • I also may add that for awesomely big world, you could use random seed.

    The idea behind that is that all number returned by this kind of random() function would always take your seed number at a start and return every time the same numbers.

    Because you might not now it but a random doesn't really exists in a computer world. Random() function are series. You take a starting number and then always apply the same operation to have the next pseudorandom number.

    Well now that I've explained that for those who didn't know.

    If you apply the same random operation for creating your big world, you can understand now that if you have the same serie of randome number you'll generate the same exact world.

    Then basically you could store an entire world in one single number (and I believe it's how minecraft works). Then you just have to store what has been modified in this world. Which would be far less than the big world.

    The only downside is that generating the world, if it's a really big one, could take some time.

    But there's some ways to split your big world in tiny ones (that's the purpose of Arsonide's gridTree plugin for Construct Classic) to avoid this overhead (also minecraft might use something like that).

    That's all (:

  • 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/

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • 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