Yann's Forum Posts

  • global variable count=0
    +on something
      -> System: set count to 0
      +Array: Foreach elements
        -> System: add Array.CurValue to count
  • +System: TowerSmall.X-Basket.X <= 300
    +BuildingFamily: Number = TowerSmall.Number
      -> BuildingFamily: Fade: start fade

    Maybe...

  • probably related to the Array Bug mentionned

  • here's a capx as example

    containerBug.capx

    I don't know if it's a bug or has designed.

    But I was expecting that I could access siblings of an object (in a container) when I create the object.

    Could be usefull for default placement and pinning.

  • When I pass a local variable as argument

    And only within a loop (for/while/repeat)

    the default value of the variable is passed even if I change it before.

    test capx: function&loops.capx

    (note that even when the condition is toggled off, the bug is present)

  • -> set vector X to knockback
    -> set maxSpeed to knockback
    -> wait knocbackTime
    -> set maxSpeed to defaultMaxSpeed

    that's usually how I do a knockback

  • cool thanks (:

  • Indeed, I think the bug I reported here has the same root problem.

    As soon as a function call contains a global/local variable in its parameters, it crashes.

  • You can do the achieve the same expected result with

    set text to Sprite.count-1

  • Hi,

    I've been playing around with recursion to test the new function feature.

    Building a simple factorial function works fine

    +Function: On "factorial"
        + Function: parameter 0 > 1
            -> return Function.Param(0)*Function.Call("factorial",Function.Param(0)-1)
        + Else
            -> return 1[/code:2kjajkjt]
    
    But then I wanted to test a recursive backtrack for generating a 2D maze.
    And there's a js bug.
    
    So here's the capx (it's the dig() function)
    [url=https://app.box.com/s/ygapi1fe12hvikra6ql2]maze.capx[/url]
    
    Also, when you change global/local variable names, the parameters in the function call don't get updated, I ended up with a crash and an invalid capx at some point.
    
    Also, parameter 0 > 1  feels weird somehow, maybe parameter[0] or parameter(0) would be betterYann2012-11-09 19:41:38
  • I wrote one in C this week.

    And I used recursivity at some point.

    For now, since functions aren't yet implemented, you probably can't do recursive algorithms.

    The cool thing with recursivity, is that you get some kind of tree of resolution for free.

    Without recursivity, you need to save in some way each iteration you are making so if you end up with an impossible solution, you can backtrack and try other values.

    Some month ago, I implemented a backtracking algorithm to create a maze, so I think it's possible in C2... but yeah just slightly harder and uglier.

  • to check a distance to the floor, you can make an invisible sprite follow your character's feet. This sprite's height will be at the distance you want your character to be hovering and then you'd just have to check for overlapping between this new sprite and the floor.

    (You can probably achieve the same result with an overlap at offset (0,distance) from your character sprite, so without the need of an extra sprite)

  • Ashley

    I showed you the issue in my capx with displaying the object.count value, but if I foreach the object it won't take the newly created ones as well. Is it because the foreach is based on the object count? (this question's aim is just to be sure that we won't end up with object count corrected but foreach still broken (: )

    and sqiddster, if you need something that is recursive, like

    on start of layout
    while
    object.count < limit
      foreach object
        -> create object

    you can distribute things over more than one tick

    object.count < limit
      foreach object
       -> create object

    (note that object:spawn is the same as foreach object -> create object)

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • looks like flood fill to me

    http://en.wikipedia.org/wiki/Flood_fill