Yann's Forum Posts

  • Ashley

    I can only imagine the complexity of that. Thanks for your effort (:

    I think functions can greatly increase the readability of a capx (and then teamwork), that's why I'm focusing on it these days and stress-test them.

    Thanks to them, I am now able to more easily separate chunks of event and avoid undesirable interactions (which makes modifying/extending/refactoring some events that much easier)

  • blackhornet

    Alright, thanks for the clarification. I must admit that I encountered this bug in a more complex situation (a maze generator) and it behaved as if the function stopped, but it could as well be due to wrong variable values (:

  • I was showing off my maze capx and then bam... broken.

    I was able to recreate the bug in a simple capx.

    Basically, if you still have stuff to do after a recursive call, well... it's ignored.

    Here's the simple capx.

    functionStopsOnRecursion.capx

    If you run the capx, nothing gets displayed.

    But if you put the

    Text: Append first&newline[/code:34f5l3k5]before the functionn call (event 3), it works as expected.Yann2012-12-09 02:10:13
  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • local variables exist in the free edition

    the limitations of the free edition are:

    • 100 events
    • 4 layers
    • 2 fx
    • no family
    • dunno about containers (?)
  • You should use a detector sprite

    Doing a "sprite is overlapping sprite" you'll never get what you want.

    You should do a

    +Mouse: on left button clicked on okay
      OR
    +Keyboard: on Return pressed
       +system: foreach tile
          local number dist = ...  //distance between each tile
          local number diet = 0
          local number habitat = 0
          local number texture = 0
          -> system: set diet to tile.diet
          -> system: set habitat to tile.habitat
          -> system: set texture to tile.texture
    
          +system: repeat 6 times
             -> set detector set X to tile.X + cos(30 + (loopindex*60)) * dist
             -> set detector set X to tile.Y + sin(30 + (loopindex*60)) * dist
    
             +system: pick all tile
             +tile is overlapping detector
                 +tile.diet = diet
                     -> system: add 1 to score
                 +tile.habitat = habitat
                     -> system: add 1 to score
                 +tile.texture = texture
                     -> system: add 1 to score

    1/ you use local variable to keep the value of the instance variable of the current tile, because you will lose the picking afterward

    2/ you do a loop on the 6 possible surrounding tile. The little trigo thing should place the detector on each these tile. (you have to provide the distance between tiles in the dist variable though)

    3/ you pick all tile to reset the picking an be able to pick other tile thanks to the detector.

    4/ you apply the rules by comparing the detected neigboring tile's instance variables to the value you stored on the local variables

    note: pay attention on how I indented the code

  • EyeHawk

    add in event 2

    System: dragging = 0

    when you are "in touch" sMX and sMY gets constantly updated so on event 4

    sMX and sMY are always equal to Touch.AbsoluteX and Touch.AbsoluteY so you have scroll to sSX + 0 , sSY + 0... no movement.

    In the original capx it was a trigger "on click" (instantaneous) not "mouse is down" (continue)

  • EyeHawk

    dunno share capx

  • easier if you show what you are doing

  • is overlapping has no action

    trigger once should be put in the same event block as is overlapping

  • you could do something like:

    Global constant number ACTIVATION_DISTANCE = 600
    
    +Every Tick
      -> badGuy: set activated to false
    
    +badGuy: X > (scrollX - ACTIVATION_DISTANCE)
    +badGuy: X < (scrollX + ACTIVATION_DISTANCE)
      -> badGuy: set activated to true
    
    +badGuy: Is Activated
      -> move (badGuy.speed * dt) at Angle (badGuy.direction)
      +badGuy: is overlapping edgeMarker
      +trigger once
        -> badGuy: set direction to (180 - badGuy.direction)

    badGuy.direction should toggle from 0 and 180 each time badGuy overlaps an edgeMarker

    this way it should easily move left and right between two edgeMarker

    Also badGuy.speed should be in pixel per seconds

  • Yeah basically if you use a global variable in an argument of the Call function action, when you change the name the action doesn't get updated with the new name. And It breaks the capx.

  • Ashley

    Yep super good, now my recursive backtracker maze algorithm works like a charm :D

    as you can see

    https://dl.dropbox.com/u/23551572/C2-Games/MazeFunction/index.html

  • Ashley

    Yep, works as expected. Thank you (:

  • Hi folks,

    Just for fun I fiddled with the Timer behavior sources

    and as it was broken (couldn't create two different timer on the same behavior), I started to rework it a bit.

    So now not only can you create as much timer as you want,

    but you also have one new condition:

    • timer "timername" is running: true if the timer is currently running

    and two new expression:

    • count("timerName"): returns the current value of the counter
    • initialValue("timerName"): returns the initial value you put in the counter

    I'll support this plugin so if you have any bug and/or feature request, feel free to ask (:

    Timer.zip

    You'll have to overwrite the original plugin to avoid conflict

    Just in case there's bugs you can fall back on the original one

    Timer_original.zip

    Have fun (:Yann2012-11-20 22:32:02

  • Ashley oh yeah sorry that's exactly that.

    I interpreted this as "I couldn't access siblings of an object when I create it" but yeah it's more a supposition of what I thought was going on than a description of the bug (: