dop2000's Forum Posts

  • Nice, thank you!

  • This may be easier to understand:

    myText="Hello, %John%! How are you?"     <-  use % to mark start and end of yellow text.
    
    letter=""
    
    textYellow=0    <-  textYellow=0 means black text, textYellow=1 means yellow text
    
    For i=0 to len(myText)-1
      Wait 0.5*loopindex seconds
      letter=mid(myText, loopindex, 1)
      If letter="%"     
                If textYellow=0  Set textYellow=1    <- next letters will be yellow
                Else Set textYellow=0                   <- next letters will be black
      Else
           If textYellow=0  bbt_dialogue_texte Append letter
           If textYellow=1  bbt_dialogue_texte Append ""&letter&"[/color]"[/code:16o5kby7]
  • See my updated comment above.

  • I'm not sure I understand you.

    When you need to display next letter of the dialog and that letter should be yellow, add this:

    ""&letter&"[/color]"[/code:2dcx5z5p]
    
    Your code could be something like this:
    
    [code:2dcx5z5p]
    myText="Hello, %John%! How are you?"     <-   Put symbol % before and after the text you want to display in yellow
    textYellow=0  
    letter=""
    
    For i=0 to len(myText)-1
      Wait 0.5*loopindex seconds
      letter=mid(myText, loopindex, 1)
      If letter="%" set textYellow=(textYellow=0)    <- this will invert textYellow variable, 0 becomes 1, 1 becomes 0
      Else 
         If textYellow=0  dialogText append letter
         If textYellow=1  dialogText append ""&letter&"[/color]"
    [/code:2dcx5z5p]
  • oosyrag, Your solution is so simple and obvious, why didn't I think of it!

    Meteor's collision polygon should be very small for it to work correctly, but still it's a great idea.

    I already made a version with tilemap, so here it is..

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

  • Thanks, R0J0hound! You rock again!

    Your method works. Although sprites tend to group more towards the right end of the line, but this actually is even better for my game.

  • It's hard to tell without seeing your capx.

    There may be something in your code, or maybe some object is missing on the level layout.

  • R0j0 made something similar in this post:

    Maybe you could use this concept in your game - "fill" planets with invisible tilemaps, with tile size something like 4x4 px. And use them for collision detection?

  • Thanks, oosyrag

    Unfortunately, most of the dropbox links in that post are dead and the one that's working is not very good. It uses "brute force" method - creates sprites at random positions and then destroys sprites that overlap.

  • newt

    If I understand your method correctly, it will distribute sprites in 10px intervals. I don't want this.

    See my picture above - one sprite may be at x=8, another at x=21 etc.

  • Nice work, mate! That was really fun!

    Would love to play the full game.

    Is there any way I can interact with the ladies?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Hey guys!

    I'm looking for an algorithm to randomly distribute sprites on the line.

    Let's say the line length is 100 px, and each sprite is 10 px wide.

    Number of sprites can be different, from 1 to 8.

    Sprites can touch, but not overlap.

    It's not a problem to distribute 4 sprites, but with 5 or more it's possible to run out of free space if I just place them randomly.

    Seems like an easy task, but I can't figure it out.

  • Try this:

    Add a special character to each letter in the string that you want to be yellow:

    myText="Hello, ^J^o^h^n! How are you?"

    Then parse this string character-by-character and when you find "^", read next letter and wrap it into {color} tag:

    H
    e 
    l
    l
    o
    ,
    
    J[/color]
    o[/color]
    h[/color]
    n[/color]
    etc.[/code:cpf80vsm]
    
    [quote:cpf80vsm]is there any way to change the plugin of my texts
    
    If you need to replace lots of text objects, you can edit XML files of the project, as described [url=https://www.scirra.com/forum/viewtopic.php?f=147&t=196534]here[/url], but it's not recommended.
  • Line of sight is just a condition. You can simply choose not to use it in an event.

    Or you can do something like this:

    As for the range, there is an action "Line of sight Set range", or you can compare distance between objects:

    System->Compare two values-> Distance(enemy.x, enemy.y, player.x, player.y)<=MaximumRangeToFire

  • what if instead of a background I wanted to make a foreground with enemies and platforms

    You should be more specific.

    Do you have something like this in mind?

    Subscribe to Construct videos now

    I guess you can use my example, define different collision polygons for each frame, add some image points. Then pin different obstacles to these image points.

    Or do you want to make an endless scrolling platformer game with character running/jumping/shooting etc? For this type of game there is a template in C2, see Zion's comment above.