Yann's Recent Forum Activity

  • I added a trick, To know what is the height of a full heart, I place 2 images points on the heart outline. One for the empty position, one for the full position. I then calculated the height between them and use it as a min/max for the height of the blood mask.

    You just have to replace theses image points and calculate the difference between imagepointX instead of imagepointY... Well send the capx if you don't succeed

  • w00t ninja'd

    Cassianno

    They are all listed in construct when you have to type an expression you should have a window (F4 if it's hidden) with all your layout object, and one of them is "system", if you double click on it you'll see all the system expression available.

    Else, you can also read this page of the fabulouse manual

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

  • you can always keep a global variable with the name or number of your top layer and use it instead of hard coding.

    I guess that if you're asking that, you might have many object that needs to switch to this layer and don't want to change the events every time you change your layer structure.

    That's the only issue I see about not having a system variable or way to find it out.

    So yeah, I would use a global variable.

  • I don't really understand what it's all about in your capx. But in short you want to make a kind of healthbar on a weird shape withough having to draw all the animation frame.

    I did something similair a while ago. I think if you understand this capx you might be able to adapt it to what you want to do:

    heartHUD.capx

    I just made this version to show how to use a texture as hp "blood"

    heartHUD2.capx

  • you can't force a game to be fast unfortunately (:

    using dt just unsure that if you want an object to move 100px per seconds, it moves exactly at this speed.

    If your fps is at 60, the sprite will move 100px/60 = 1.67 px per tick

    If your fps is at 30, the sprite will move 100px/30 = 3.33 px per tick

    If your fps is at 2, the sprite will move 100px/2 = 50 px per tick

    So the higher the fps, the smoother the movement.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Jayjay

    It works only for horizontal movements and also you should multiply by dt to make it framerate independant.

    using the same method for any movement would be

    Sprite: Set X to self.X+cos(angle(self.X,self.Y,B.X,B.Y)*SPEED

    Sprite: Set X to self.X+sin(angle(self.X,self.Y,B.X,B.Y)*SPEED

    and if you want to be framerate independant it will look like

    sprite: Set X to self.X+cos(angle(self.X,self.Y,B.X,B.Y)*SPEED*dt

    Sprite: Set X to self.X+sin(angle(self.X,self.Y,B.X,B.Y)*SPEED*dt

    In fact, it's exactly what "moving at angle" does

    But it might lead to wiggling when the sprite reach the B point. Because you might not end up with B.X,B.Y precisely.

    That's why using lerp is probably better (: you get the framerate independancy and precision.

  • Global number speed=10   //px per second
    Mouse: On left Click
      -> Sprite: set xA to Sprite.X
      -> Sprite: set yA to Sprite.Y
      -> Sprite: set xB to Mouse.X
      -> Sprite: set yB to Mouse.Y
      -> Sprite: set t to 0
      -> Sprite: set moving to true
    Sprite: is moving
      -> Sprite: set t to clamp(self.t+dt*speed*1/distance(self.xA,self.yA,self.xB,self.yB),0,1)
      -> Sprite: set X to lerp(self.xA,self.xB,self.t)
      -> Sprite: set Y to lerp(self.yA,self.yB,self.t)
    Sprite: t = 1
      -> Sprite: set is moving to false

    if you want a constant movement

  • Array are 0-based so the for loop should spanned from 0 to width-1 and height-1

    Also it would help to know why you want to use these number and also yeah the | operator is a OR used with a boolean type of variable.

    Any number except 0 returns TRUE when they are read as boolean.

    0 returns FALSE.

    So when you write

    0|4|9|12

    it's as if you were writing

    FALSE or TRUE or TRUE or TRUE

    which returns TRUE and TRUE into an integer is 1.

    But even if I were to read your code thinking as "this value equal 0 or 4 or 9 or 12" I really don't understand the meaning behind it.

    And last, your text wasn't used the right way to display your array values. Each time you were picking all your text objects. And the even wasn't at the proper nesting level.

    Check that out (I made some uneeded changes like using local variable x and y as loopindex 'cause I like shortcuts )

    arrayRandom.capx

  • In a turned base, you have to isolate phases.

    You could isolate these phases into different groups to switch on and off.

    Or use a variable "phase" like that:

    Global number phase = 0
    +System: phase = 0
      [insert the first phase code]
      +on phase validated
        -> System: set phase to 1
    +System: phase = 1
      [insert the second phase code]
      +on phase validated
        -> System: set phase to 2
    +System: phase = 2
      [insert the third phase code]
      +on phase validated
        -> System: set phase to 0
  • +System: Every 7 seconds
    Local number rndCount = 0
      -> Object: destroy
      -> System: rndCount = floor(random(5))+1
      +System: repeat rndCount times
        +Spawnpoint: [invert] is occupied
        +System: pick random Spawnpoint instance
          -> Spawnpoint: Spawn object on layer 3
          -> Spawnpoint: set occupied to True
Yann's avatar

Yann

Member since 31 Dec, 2010

Twitter
Yann has 5 followers

Connect with Yann