dop2000's Forum Posts

  • You should remove this detailed description of the game from public access.. Someone might want to steal your idea.

    So this will be a text based game? Lots of text, number, buttons, lists, dice and some static images?

    Construct 2 may not be the best tool for this kind of game. But you can still make it in C2 if you want.

    I suggest you start with implementing one mechanics - for example trading or combat. And then add more.

    You need to think about how you are going to organize and store all the data. Read a few tutorials about arrays, dictionaries.

    Install CSV plugin - you'll definitely need it.

  • CurrentKey and CurrentValue only work inside the "For each key" event

  • If every action in your text object is followed by a line break (newline expression), then you can remove the oldest lines from the beginning of the text before adding new lines.

    For example, your text object can display 4 lines.

    When you need to add the 5th line, remove 1st line from the text. You can do this using find(text.text, newline) or tokenat/tokencount expressions.

    aaa        bbb        bbb
    bbb   ->   ccc   ->   ccc
    ccc        ddd        ddd
    ddd                   eee
    [/code:3bo0spi6]
    
    Alternatively, you can try rex's "Text Scrolling" plugin.
  • Why don't you apply force to boosters? See this demo:

    https://www.dropbox.com/s/zybwrux82hmhm ... .capx?dl=0

    (I don't have much experience with physics joints and I'm not sure if I'm using them correctly)

    You can also try Chipmunk behavior, it has "Apply force at offset" action, so you should be able to apply force at the point where the booster is placed.

  • I don't think it's possible. You can open two projects and copy/paste objects from one capx to another.

    If objects in all capx are identical and you need to combine layouts, you can unzip capx and try copying or editing xml files, but there is a good chance that this will corrupt your project..

  • I tried replacing ^ with value*value, didn't notice any change in fps.

    And when I'm using actual sprite coordinates instead of random values, surprisingly distance() expression is faster!

    distance(Sprite.X, Sprite.Y, Sprite2.X, Sprite2.Y)<500

    is about 3-4 FPS faster than

    (Sprite.X-Sprite2.X)*(Sprite.X-Sprite2.X)+(Sprite.y-Sprite2.Y)*(Sprite.y-Sprite2.Y)<250000

    Anyway, I will stop worrying about using distance() in my games

  • Dictionary stores data in pairs - key and value. For example:

    "Name": "Small sword"

    "Damage": 25

    "Weight": 10

    It's quite easy to use and everything is covered in the official manual.

    https://www.scirra.com/manual/140/dictionary

    Here is a lengthy tutorial:

    http://javajdk.net/tutorial/construct-2 ... -tutorial/

  • justme5555

    It crashes because you made an infinite loop.

    here is my capx:

    https://www.dropbox.com/s/9vzv93pi7e8ji ... .capx?dl=0

  • ,

    I read about square root being CPU costly before. After your comment I decided to compare (in C2):

    When I disable either event #3 or #4 and run the project in debug mode, there is almost no difference between two methods.

    With distance expression I'm getting 21-22 fps, and with squared values about 22-23 fps. CPU load is the same, around 97-100%.

    Is the difference really that small or am I doing something wrong?

  • Nice work, but how is it different from array? What are the advantages?

  • netdzynr

    You function sometimes produces results like "hellowXrld" when limit field is set to 3.

    Here is a slightly shorter version:

    The word should contain at least 3 letters, otherwise it will go into an infinite loop.

    You can add another condition to the While loop, for example "Loopindex<50" to prevent this from happening.

  • You can't pick any "abstract" object by UID.

    What you can do is to add all sprites to a family. Then in your function you pick a family member by UID.

    If you want your function to be even more universal and be able to process not just sprites, but also text objects, tiledbackgrounds etc, then you need to make several families, and your function can look like this:

    On Function "ApplyEffectToAnyObject"

    ...SpriteFamily pick by unique ID = Function.Param(0) -> do something with picked SpriteFamily instance

    ...TextFamily pick by unique ID = Function.Param(0) -> do something with picked TextFamily instance

    ...

  • You can set target angle to this expression:

    LiteTween Set Target to (currentlAngle<180 ? 0 : 360)

    This means "if current angle <180, then target angle 0, else target angle 360"

  • Mouse : Cursor is over object -> display info

    Else -> Remove info

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Here you go:

    https://www.dropbox.com/s/tetv3j8m1psww ... .capx?dl=0

    I suggest you use MoveTo or LiteTween behavior to move menu items instead of lerp. You can get much nicer looking movement and you'll be able use events that trigger when the movement has ended.