Yann's Forum Posts

  • Did you try the canvas plugin?

  • Your code is weird. On creation you directly set a random angle, and then you store it in Last_Left_Angle to discard it afterward... What is the point? It will still look like a basic choose(0,90,180,270)

    But I think I understand what you want to do, I would do it like that:

    Global number Last_Left_Angle=-1 // no discarding at start
    +TrenchTile: Wall = "Left"
    +TrenchTile: Pick nearest to (0,0)
    +TrenchTile: Y > 60
      Local choice = ""  // to store the possible angles 0,1,2,3 * 90
      +System: repeat 4 times
      +System: loopindex is not equal to Last_Left_Angle
        -> System: set choice to (choice = "") ? loopindex : ","&loopindex
      -> System: Create object TrenchTile on layer "Tiles Front" at (Left_Wall+Wall_Move, TrenchTile.Y-TrenchTile.Height)
      -> System: set Last_Left_Angle to floor(random(4))
      -> TrenchTile: set angle to Last_Left_Angle*90
  • For now, spawning a high amount of tiles isn't super efficient performance wise. I did a little tetris for fun some weeks ago, and the more block you have in the layout, the slower and laggy it gets

    You can see for yourself

    http://dl.dropbox.com/u/23551572/C2-Games/tetris/index.html

  • The main difference are that collision is a trigger and overlap isn't.

    Thus collision is an instant condition, it's true the first tick where the object start overlapping, and then false.

    But! It's a trigger. So it's not exactly the same as doing

    Object: is overlapping
    System: trigger once

    The main difference as far as I know is that triggers aren't checked in the main event loop order. But (not sure) checked before even running the entire game loop, for better speed.

    So you have to be aware that orders between triggered and non trigger events might not be respected. (but order inside a triggered block or between triggers of the same nature are respected)

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • No need to throw toggling into the pit of obliviousness, toggling is usefull and not that buggy.

    But you should either toggle an entire event or some specific actions.

    Toggling a condition is seldom use.

    It's only usefull if you want to rapidly compare two conditions without deleting any.

    The difference between toggling a condition and an entire event, in the UI, is that when you select a condition you only see the condition outlined whereas when you select an event the entire condition+action block (+ eventually sub-events) should turn yellow.

  • I get a js bug 'cause you toggled off two for loop at start of frame (GameSheet event 2 and 3) but still refer to loopindex in the action.

    Just delete that part. Didn't test it but that might be the issue.

  • you can start with that

    gridMovement.capx

  • 'cause the image point is at the center of the sprite. If I don't offset things by half the width and half the height you will have half the sprite out of layout. But maybe it's not a problem for you (:

  • hmmm try looking at tokenat and tokenCount system expression.

    http://www.scirra.com/manual/126/system-expressions

  • Dont use shape_1, shape_2 and shape_3 but an array

    Else you will have to rewrite the whole thing for each

    global text shape_all = "shape_red:shape_blue:shape_purple:shape_yellow:shape_green:shape_orange"
    global shapeCount = 3  // number of shape you want
    +System: on start of layout
      -> Array: set size to shapeCount,1,1
      + Array: foreach X elements
        -> Array: set value at (self.CurX) to "empty"
    +On What you want
      Local text tmp = ""  // copy to keep the original intact
      +repeat shapeCount times
        -> System: set tmp to shape_all
        -> Array: set value at loopindex to (tokenat(tmp,floor(random(tokencount(tmp,":"))),":"))
        -> System: set tmp to replace(tmp,Array.At(loopindex),"")
        -> System: set tmp to replace(tmp,"::",":")
        -> System: set tmp to (left(tmp,0,1) = ",") ? right(tmp,len(tmp)-1) : tmp
        -> System: set tmp to (right(tmp,len(tmp-1),1) = ",") ? left(tmp,len(tmp)-1) : tmp

    The four last actions are used to delete the token from the tmp string. This way you don't pick it again.

        -> System: set tmp to replace(tmp,Array.At(loopindex),"")

    Delete the token leaving the colons

    1:2:3 -> ":2:3" or "1::3" or "1:2:"

        -> System: set tmp to replace(tmp,"::",":")

    Check if there's two colons side to side and delete one

    1:2:3 -> ":2:3" or "1:3" or "1:2:"

        -> System: set tmp to (left(tmp,0,1) = ",") ? right(tmp,len(tmp)-1) : tmp

    Check if the first character is a colon and delete it

    1:2:3 -> "2:3" or "1:3" or "1:2:"

        -> System: set tmp to (right(tmp,len(tmp-1),1) = ",") ? left(tmp,len(tmp)-1) : tmp

    Check if there's a colon on the last character is a colon and delete it

    1:2:3 -> "2:3" or "1:3" or "1:2"

  • clamp just limit values between a minimum and a maximum

    self refers to the object from which you do the action.

    awesomeSprite: Set X to self.myVar

    is the same as

    awesomeSprite: Set X to awesomeSprite.myVar

  • Damn I've been Kyat ninja'd

    /On the layout there are four hidden objects called (book,table,spoon,lamp) each of them has at least 10 frames, so I can't create only one object and then calling a random frame.

    You can... And you should!

    Basically I would setup the layout this way:

    A Sprite called 'item' in which you put your animation of book,table,spoon,lamp.

    Name the animations properly.

    Then if you want to call a random object

    System: Create item
    item: set animation to tokenat( pool , floor( random( tokenCount(pool ,",") ) ), "," );

    If you want to pick a specific object and play his animation

    item: is animation "spoon" is playing
      -> item: start animation from current frame

    Little remarque on the last one: even if the animation is stopped as long as you display a frame from a specific animation the "is animation playing" is true.

    In short you can use the name of the animation as... naming as you implied I think.

    Also, if you have many animation per object, you can still use the name as a prefix

    spoon_idle, spoon_run (oh noes a running spoon /o/)

  • Ok, I think we are running in circle, you should describe a bit more about your game, the solution might be quite simple, but just asking for some specific feature might not be the correct angle to tackle this problem.

  • put all the hud object in a family

    global number mXStart = 0
    global number mYStart = 0
    System: On start of layout
      -> hudFamily set xStart to self.X
      -> hudFamily set yStart to self.Y
    Mouse: on Left Click
      -> System: set mXStart to mouse.X
      -> System: set mYStart to mouse.Y
    Mouse: left button is down
      -> hudFamily set X to self.xStart+mouse.X-mXStart
      -> hudFamily set Y to self.yStart+mouse.Y-mYStart
  • The question you have to ask yourself is why you want to pick a specific instance instead of another. By answering this question you'll find how to pick it.

    For example if you want to pick a specific instance because it's underneath the cursor

    +Mouse: is over Sprite
      -> Sprite: set myCustomID to 1