Yann's Forum Posts

  • Games

    Nope! It's a good solution. The else is bound to the evaluation of the condition it's "elsing", since this evaluation happens before the action, the else will not be triggered.

    RamPackWobble

    Using a boolean instead of a global number is not equivalent though it might be a better solution in this case. But we can't say without seeing the big picture.

    I would guess that you probably want to use a boolean for the semantic (meaning) of a 0/1 switch, but to me it's more because c2 doesn't provide boolean types for globals than for a good design reason.

    (To counter c2's flaw, I usually declare two global constant TRUE = 1 and FALSE = 0 and use that in expressions)

  • Try Construct 3

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

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

    Oh ok, got it, I'd actually never noticed that object parameters weren't "container-aware" (:

  • Set BestDistance to WebStorage.LocalValue("BestDistance")  [/code:1e07swc4]
    And
    [code:1e07swc4]Set local key WebStorage.LocalValue("BestDistance") to BestDistance  [/code:1e07swc4]
    Don't forget the quotes.
  • gfigueroa

    you could do something like

    + System: distance(touch.X,touch.Y,character.X,character.Y) < speed * dt
            -> set character to (Touch.X,Touch.Y)
    + else
            -> move (I don't remember how the character is moved though :D) [/code:1cthm65q]
  • All programming language share a lot of similarities. I don't think you can pick a wrong language (unless a wrong one would be one so complex that it discourages you).

    Once you know one language, learning another becomes easier. And little by little, you start to have a glimpse at a bigger picture. And if someone ask you to write something in an hypothetical language Q, you just think "ok, few days to learn the Q syntax and features and I'll get to work"

    Javascript is a nice language, mostly because you can just get starting using chrome. It has however a few annoying sides (high tolerance to errors (complicate debuggin), no memory handling (limit optimization), no package/module system, to name a few).

    This site could be a good start.

  • If you want to find a job using C2, you have two possible choices:

    1 - make more refined games to put on your portfolio (and do create a portfolio website instead of just showing youtube videos) where Potential Employer could test your game. Doing this, you would sell yourself as a game designer. Showing a lot of original gameplay and how well you can balance them to create a good experience would be the goal of those refinements. Also, you cannot ignore graphics. Even if you're not an art guy, Potential Employer will just skip you if your product is ugly even if the gameplay is good. Presentation is alway important (and after all in "game designer"... you still have "designer"...)

    2 - If you want to sell yourself as a game programmer, learn a few programming language (Java, C, javascript, python, ruby,... ). C2 isn't ready to be professionally used in studios (though it happens). For a studio, it's a dangerous bet to make a project in C2 as it's hard to work with more than one "C2 programmer" at a time and because once a project gets past 500 events, it starts to get really hard to maintain. Since C2 doesn't enforce any kind of encapsulation, you'll start to enter the hell of "I change something somewhere, it breaks something somewhere else". Learning other programming languages however will make you a better C2 programmer, and also will make you more flexible in the Potential Employer's eye. For example, if C2 doesn't work out, you could still develop android games (java) or at least create plugins to make C2 behave (javascript). Also you would have more options to solve any given problem (as being a programmer is being a problem solver).

    So you can choose either the first or the second... or the two solutions (why not )

    As you are now, selling yourself professionnally might still be a bit hard, but you're on the right track o/

  • Be carefull, it's

    (ViewportLeft("Layer") + ViewportRight("Layer")) / 2[/code:2k2l7if5]
    With the parenthesis. You need to sum the values first and then divide by 2 (it's the average between the two positions)
    
    I usually use something slightly more flexible:[code:2k2l7if5]Object: set position to  (ViewportLeft(Self.LayerNumber) + ViewportRight(Self.LayerNumber)) / 2[/code:2k2l7if5]
    
    Also if you want something 10 pixels from the left of the screen, you just have to do [code:2k2l7if5]ViewportLeft(Self.LayerNumber) + 10[/code:2k2l7if5]
    But if your layer is scaled, 10 pixels might appear greater or smaller than expected.
    
    The way to counter layerscalling might be to do
    [code:2k2l7if5]ViewportLeft(Self.LayerNumber) + 10/LayerScale(Self.LayerNumber)[/code:2k2l7if5]
    
    Also, to be really complete, if your layer's scale rate isn't 100% you might need to do
    [code:2k2l7if5]ViewportLeft(Self.LayerNumber) + 10/(LayerScale(Self.LayerNumber) * LayerScaleRate(Self.LayerNumber))[/code:2k2l7if5]
  • RamPackWobble you do have a point here, I noticed going through c2's javascript that dt was clamped to 0.1

    It's a common technique to avoid object teleportation. But yeah in sinneruy's specific case it might be detrimental.

    I modified the capx to compute my own dt using wallclocktime. It should counter this issue.

    hiddenObjectClock.capx

  • C2 automatically gather all animations on one big texture on export, so under the hood it exactly does what you are suggesting.

  • That's how I would implement your system

    hiddenObjectClock.capx

    dt and time have the same accuracy, as time is internally computed by adding dt to it each frame.

  • Not possible. And you don't really need other layouts anyway.

    A layout is an abstract concept that is mainly important when you edit your game (when you make the level manually for instance)

    The only thing that matters in your case is displaying something on the screen. Whether it's in one layout or another is irrelevant.

    If you want an infinite universe, you just have to know what you have to display according to your data representation.

    And if you want to have on part of your came representing the entire space and another part where you actually land on a planet... I would just have a Space layout and a Planet layout. When you enter a planet you just have to go to the Planet layout and generate the corresponding planet.

    If you worry about persistency (going back to the same planet should generate the same random one), you have to use some nifty seed hierarchy. But I trust you know about that =)

  • Well, why not directly using the Tint effect then? or even Tint with Adjust HSL if you want more control?

    Demo

    capx

  • dt (deltatime) is the time (in second in c2) elapsed between the previous frame and the current.

    So if you accumulate them you'll reach 1 in one second.

    If you run at 60 fps (frame per second), the time between two frame is about 0.016s (1/60)

    So after 60 frames, 1 second will have elapsed and you would have acumulated 60 * dt = 60 * 1/60 = 1.

  • ^\S+\s means a line which starts with one or many non white-space character followed by one white-space character (but I think you got that one)

    g (global) means you want to replace all the occurence of your regex. Without it would only match the first one.

    However in your case, since you're not using the m flag (multi-line), even if your text contains line break, ^ will only consider the begining of the entire string (whith m it considers each line one by one).

    So the g flag is useless since you'll only ever have one occurrence matching.

    more info over there

  • newt using an instance variable would be redundant in this case.