Yann's Recent Forum Activity

  • if you have tones of action that are triggered by different events you can also use a local variable to fake a "or"

    +[empty]
      local nubmer or = 0
      +ConditionA
        -> System: set or to 1
      +ConditionB
        -> System: set or to 1
      +Systeme: or = 1
        -> Execute
        -> My
        -> Tones
        -> Of
        -> Action

    Against a simple OR use it's just one more action per condition

    +ConditionA
    +OR
    +ConditionB
      -> Execute
      -> My
      -> Tones
      -> Of
      -> Action

    So it's not so bad

    Of course if it's just one or two action it might be an overkill solution

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • QA.capx

  • As long as it uses family variable instead of instance variables yes

  • ah "exported through phonegap" ... I've never done that... Can't help you on that (: But the way I used the particle object is the way you should normally use it for an instant effect like yours.

    For the rest, maybe you should try to post your issue on the bug forum.

  • works the same on firefox and google chrome... didn't test on ie... I'm still on ie8 and too lazy to update that thing.

  • It seems you wanna use a one shot particle

    oneShotParticle.capx

    didn't test it but should work.

    Little note for Ashley

    I noticed that there wasn't a property to randomize particle rotation on creation. Also it would be interesting to have a rotation speed too (and rotation speed randomizer)

    Which isn't exactly the same as the actuall angle randomizer.

  • Well Kyat you said it all,

    For the reference point you can take the average point

    Global number scale = 1
    System: On Start of Layout
      -> Object: set scale to scale 
    on anything
      Local number xSomme = 0
      Local number ySomme = 0
      Local number cx = 0  // X center of scale
      Local number cy = 0  // Y center of scale
      [Empty]
        -> System: set scale to 0.5
      System:Foreach object
       -> System: add object.X to xSomme
       -> System: add object.Y to ySomme
      [Empty]
       -> System: set cx to xSomme/object.count
       -> System: set cy to ySomme/object.count
      System: Foreach object
       -> Object: set distance to distance(cx,cy,self.X,self.Y)
       -> Object: set a to angle(cx,cy,self.X,self.Y)
      [Empty]
       -> Object: set distance to self.distance/self.scale
       -> Object: set width to self.width/self.scale
       -> Object: set height to self.height/self.scale
       -> Object: set scale to scale
       -> Object: set distance to self.distance*self.scale
       -> Object: set width to self.width*self.scale
       -> Object: set height to self.height*self.scale
       -> Object: set X to cx+cos(self.a)*self.distance
       -> Object: set Y to cy+sin(self.a)*self.distance

    Should work but untested.

    Explanation :

    System: On Start of Layout
      -> Object: set scale to scale 

    We make sure each object always "knows" at which scale they are. Else if you want to put the scale to 0.5 when the scale is already at 0.5 you might end up with a scale at 0.25...

    on anything
      Local number xSomme = 0
      Local number ySomme = 0
      Local number cx = 0  // X center of scale
      Local number cy = 0  // Y center of scale
      [Empty]
        -> System: set scale to 0.5
      System:Foreach object
       -> System: add object.X to xSomme
       -> System: add object.Y to ySomme
      [Empty]
       -> System: set cx to xSomme/object.count
       -> System: set cy to ySomme/object.count

    "On anything" 'cause it depends on your implementation.

    We declare some local variables

    We set the scale to whatever you want (here 0.5)

    The rest is pretty much an average calculation. To take the average between a bunch of number you add them and then divide by the number of value you added. I do the addition in the foreach and the division in the [Empty] condition (for those who doesn't know [empty] is the same as "Every Tick")

      System: Foreach object
       -> Object: set distance to distance(cx,cy,self.X,self.Y)
       -> Object: set a to angle(cx,cy,self.X,self.Y)

    We calcultate the distance from the average point and the angle and we store them in instance variables 'distance' and 'a' ('angle' couldn't be used as it's the angle of the object).

      [Empty]
       -> Object: set distance to self.distance/self.scale
       -> Object: set width to self.width/self.scale
       -> Object: set height to self.height/self.scale
       -> Object: set scale to scale
       -> Object: set distance to self.distance*self.scale
       -> Object: set width to self.width*self.scale
       -> Object: set height to self.height*self.scale
       -> Object: set X to cx+cos(self.a)*self.distance
       -> Object: set Y to cy+sin(self.a)*self.distance

    As we only operate on instance variable properties we don't need a foreach (it's kinda implicit).

    [1st to 3rd action] we bring distance and size back to what it would be at scale 1. As we always store the current scale in the 'scale' instance variable.

    [4th action] We apply the 'scale' global number to the 'scale' instance variable (oh yeah just to confuse you :D)

    [5th to 8th action] Then we apply the scaling transformation on distance and size.

    [9th and 10th action] We move objects toward or away from the average center depending on 'distance' and 'a' (obviously angle never need to be scaled)

    That's al foks

  • First, I think you made stuff a bit complicated.

    You don't really need to change gravity, just to control vector Y

    If you want your character to not fall always set vector Y to 0 and for moving up and down it looks like you found out (:

    Anyway, the thing I don't quite understand is why you spawing the Ladder1 object. What is it for ?

    Second, if you give me a stripped version of your capx, just with your character some animation, a ground and a ladder object, I can more easily tweak things to show you.

    That's all (:

  • You do not have permission to view this post

  • Probably (:

  • hmmm I would do something like

    On what you want
      Local UIDfirst = -1
      Local lapTime = -1
      System: foreach vehicle
        System: lapTime = -1
          -> System: set lapTime to vehicle.lapTime
          -> System: set UIDfirst to vehicle.UID
        System: lapTime > vehicle.lapTime
          -> System: set lapTime to vehicle.lapTime
          -> System: set UIDfirst to vehicle.UID

    and you should end up with the UID of the vehicle with the shortest lapTime in the UIDfirst local variable.

Yann's avatar

Yann

Member since 31 Dec, 2010

Twitter
Yann has 5 followers

Connect with Yann