Voytek's Forum Posts

  • Thanks for contributing, but it is not what I need. I basically want to destroy sprites in a row without destroing other sprites. I will allow bullet to pass other sprites from a different row till the chosen row is destroyed but according to a random order based on a unique random number. Like I showed.

    The first sprite to be destroyed can be in any row and it can be any sprite in the row. But The choice of the sprite to be destroyed first is based on a unique generated random number from 1 to 3. that is why i have instance variables to check them against the random number. Once a sprite is destroyed correctly, i want a player to destroy another sprite but this time in the very same row based on a different unique number i.e. no the one from the first shooting. Then the last sprite is to be destroyed in the same row.

    In other words, once a player hits one sprite correctly, because for instance he gets random number 1 and green sprite is the one with instance variable 1, I further want the player to stay committed to destoying other sprites in the same row. The player will have two other sprites to choose. However, he is not free to choose, because he is given a random number again, and he has to identify the sprite to destroy. At last he is left with the last sprite in the row to destroy.

    And the cycle repeats.

    Right now i have tried different things and my capx is a mess. Will try to do something about it if no one gets what i intend to do.

  • To solve my problem, I tried:

    I tried calculating uid, but it is useless, because uid get recycled.

    I tried adding family instance variable when red gets hit but that family instance variable affects all green sprites, and it does not differentiate sprites.

    Description of a problem:

    I spawn 3 sprites in a line, their order in a line is random. There is green sprite (Green), red sprite (Red) and blue sprite (BLue) in rows that get spawned like so:

    ..............Red Green Blue (dots.... represent blank space)

    Green Red Blue

    ...................Green^ Red* Blue’’

    Blue Green Red

    A player will shoot at the sprites from the bottom. I have got this ready.

    Sprite green has instance variable = 1, sprite Red = 2, sprite blue = 3

    Then I generate random number 1, 2 or 3.

    Let’s say I get 2. Then I want a player to shoot any of the Red Sprites, because they have instance variable 2, it is possible, because they move.

    Let's say a player succeeds hitting sprite Red with an asterix Red*. I destroy the Red*, then I generate a number either 1 or 3.

    Let’s say I get 1. NOW I want a player to hit ONLY sprite red’s Green^ neighbour EXCLUSIVELY. THIS IS WHERE THE PROBLEM IS. I CAN'T do it, because I do not know how to pick this particular sprite. I want the player to keep shooting but only hitting Green^ takes effect. Once a player would do it, I destroy Green^.

    Then I want a player to shoot sprite marked with quotation marks Blue’’ EXCLUSIVELY just like the Green^ described above. I CAN'T do it.

    After that the whole logic starts from the beginning with a random number selected.

    I have got the shooting ready. I cannot do the destruction in the right order as described above.

  • You do not have permission to view this post

  • You do not have permission to view this post

  • Thank you, it appears to work!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I know that in javascript it is possible to have a string and then put it into an array:

    <!DOCTYPE html>

    <html>

    <head>

    <meta charset="utf-8">

    <title>Break a string and convert it into an array of words.</title>

    </head>

    <body>

    <script>

    var str = "there is a cat with a lack of dog in the attic";

    var words = str.split(" ", 10);

    for (i=0; i<words.length; i++){

    console.log(words);

    }

    </script>

    </body>

    </html>

    I know how to get input from a text box, but I do not know how to break the string from that input into array.

    I would like to be able to do the same as the code above, preferably rbe able to set a limit as well, in my example, it is 10.

    In the end I would like to store each sentence as a different array, so I imagine I will have one array

    and I would be filling it with arrays deriving from strings coming from the input.

    How can I achieve all that, perhaps i might be able to figure out storing these arrays but i am already blocked, because i do not know how to convert a string into array in the first place, just like described above, but in construct.

    Thank you in advance!

  • Thanks for your feedback. Your contribution has showed me what could be done.

  • I would like a player to decide on sprite images and be able to upload them into a game before the game begins.

    Additionally, would it be possible to have the image sprites trimmed to certain size or keep them within dimensions of a certain scale during the upload process?

  • Thank you for your exhaustive answer. It seems I should manage to make it work with the information you provided. You are incredibly knowledgeable in the field!

  • I know how to display a text in a text object from a textbox. However, the input may vary, sometimes it can be longer, sometimes shorter. What I would like to do is to make the text object somehow recognize the font size as well as the length of characters and scale itself to fit the content passed from the textbox and display it neatly and efficiently in terms of space within the text object. In other words, i would like the text object to fit/scale istelf automatically to the content being typed by the user and the font size chosen by the user. Please provide the example or share a screen shot/s if possible.

  • Brilliant! The simple things are the hardest. Not to mention the really hard. Thanks hundreds of times!

  • Yeah, they are kind of random, all I wanted to do was to preserve the density i.e. vertical distance between the spawn objects while incrementing the speed, and then write a formula. How did you come up with it? I mean how did you know that there has to be some constant number involved? I am sorry if it is a trivial question to you, but it is not for me. I am asking out of curiousity. Thank you a LOT!

  • Say I have the following:

    20 (speed) = 10 (spawn time in seconds)

    100 = 3

    200 = 2,25

    How do I programme a formula for the seconds so that the values of seconds get automatically calculated based on the user's speed input according to the pattern above?

    Say the user wants now a speed of 250. How do I programme the formula calculation for the seconds based on the above pattern? Of course the calculation should work for any given input of speed, like 10 for instance. I am really lost here.

  • Thanks for the reply @kriand . I still welcome contributions of other programmers may they be any.

  • I know it is generally a matter of trial and error and what "feels the best". However, I thought someone has figured out the "sweet spot" between the bullet speed and spawn time and thus the progressive incrementation of the two.

    My enemies do not shoot. They just fall down in horizontal lines of three enemies in each line. If i could translate, for instance, the speed values and spawn time in Tetris into Construct 2 values, then i would know it is definitely a very "playable" solution. This is what i have had on my mind.

    Ps: I am sorry if it is a completely dumb question but what is the value of bullet speed in construct 2/3? I am asking out of curiousity. Is it pixel divided by time in miliseconds?