Yann's Forum Posts

  • System: on start of layout
      Local number curFrame = 0
      -> System curFrame = Sprite.AnimationFrame
      -> Sprite: set frame to 4
      -> Text: set text to Sprite.ImageWidth
      -> Sprite: set frame to curFrame

    Doesn't work?

  • nope Unique ID and Instance ID are automatically assigned on creation

    By setting a unique ID arbitrary you would have risked it to not be unique anymore...

  • nope 'cause 'mySprite' isn't the name of an object, but the name of an objectType. The object you have on your canvas are instances from this objectType.

    There's two ways to refer to a specific instance:

    • picking
    • using IID in expression

    To pick you have to isolate an object via a condition.

    It could be for example

    - mouse: is overlapping this object

    - object: pick by Unique ID

    - System: pick nth instance of an objectType

    - object: myVar = something

    - ...

    Any condition for which the specific instance will be true will initiate the picking of this specific instance, and then you'll be able to use it and only it in an action

    The other one is using IID in expression. Each instance of an objectType has an Instance ID.

    (Not the same as UID, Unique ID is a Unique number identifying all objects present in your layout, whereas IID are assigned by objectType)

    Then via this IID you can do something like

    System: Every Tick :
      -> Sprite: Set angle to angle(self.X,self.Y,Sprite((self.IID+1)%Sprite.Count).X,Sprite((self.IID+1)%Sprite.Count).Y)

    Basically each Sprite will angle toward the next in the IID list. (I used that in cubemaze to draw the ellipse in the menu)

  • Global Text groupList = ""
    + System: on start of layout
      -> set Text groupList to : "zero,one,two,three,four,five
    zero,one,two,three,four,five
    zero,one,two,three,four,five
    zero,one,two,three,four,five
    zero,one,two,three,four,five
    ..."

    Each line is a group with its values.

    And then if you want to pick a random value from let say, group 3

    + On what you want
      Local Text group = ""
      -> System: Set group to tokenat(groupList,3,newline)
      -> Text: set text to tokenat(group,floor(random(tokenCount(group,","))),",")

    Works like a charm.

  • Oh sorry I didn't link the right capx

    You can pretty much settle this in one event

    I have three because I separate collision from animation sprite and I also have idle anim the one you would use is the second one.

    8dirAnim.capx

  • It depends on how you implement your game.

    But let say you have hole sprites and mole sprites that randomly spawns over the hole sprites, stay for like 0.5 second, and gets destroyed afterward.

    Then you can do somthing like

    Mouse: on click on hole
      Mouse: is over mole
        -> System: add 1 to score
      Mouse: [invert] is over mole
        -> System: substract 1 from score
  • Ball.Physics.VelocityX > 0 move right

    Ball.Physics.VelocityX < 0 move left

    Ball.Physics.VelocityY > 0 move down

    Ball.Physics.VelocityY < 0 move up

  • go to layout (by name)  "lvl "&floor(random(4)+1)
  • hmmm damne ninja'd

    caveGeneration.capx

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • The proper way to do that is

    str(Array.At(0,0))&Array.At(1,0)

    You have to convert integer type into string type for the concatenation to work. Once you have a base string, all that is concatenated to it will be converted.

    Also the bitwise operation 5 & 2

    in binary looks lik 0101 & 0010 = 0000 not 1

    1 probably means "it's not null or false" or something like that.

  • You do not have permission to view this post

  • yeah your right

    x = cx + cos(-layerangle+angle(cx,cy,xR,yR)) * distance(cx,cy,xR,yR)

    y = cy + sin(-layerangle+angle(cx,cy,xR,yR)) * distance(cx,cy,xR,yR)

  • Wastrel yeah the plugin hasn't been updated for too long and there have been a change in naming. you should open the DataStorage runtime.js and do a search and replace from cr.plugins to cr.plugins_ (if I remember there's just 3 occurences)