TwinBlazar's Forum Posts

  • I think you can use this system condition below and put all of your ( (a = 1 && b = 1)|| c = 1 ) into the first expression and put 1 into the second expression:

    [quote:36jiy9x3]

    Compare two values

    Compare any two expressions (which can either numbers or text) with each other. They can be compared as Equal, Not equal, Less, Less or equal, Greater or Greater or equal.

    source: https://www.scirra.com/manual/124/system-conditions

    Also, the comparison operator for AND and OR in C2 is not && and ||, but & and |.

    See:

    [quote:36jiy9x3]

    Operators

    You can use the following operators in expressions:

    + (addition)

    • (subtraction)

    * (multiplication)

    / (division)

    % (modulo, remainder after division)

    ^ (raise to power, e.g. 5 ^ 2 = 25)

    & (build strings, e.g. "Your score is: " & score)

    There are also comparison operators =, <>, <, <=, >, >= for comparing values. They return 1 if the comparison is true or 0 if false.

    & can also be used as logical AND, and | is a logical OR operator. These are useful combined with the comparison operators, e.g. score < 0 | health < 0, which also return 1 if true and 0 if false.

    ?: is a conditional operator, which allows you to test conditions in expressions. This is especially useful when used with the comparison operators and logical operators. It takes the form condition ? result_if_true : result_if_false

    e.g. health < 0 | score < 0 ? "Game over!" : "Keep going!".

    The condition counts as true if it is non-zero, and false if it is zero.

    source: https://www.scirra.com/manual/78/expressions

  • Cuz using animated sprites for waterfall mean the number of objects required for copy and paste could be tremedous depending on how many waterfalls there are in the layout.

    Also, if the waterfall is long, how many waterfall objects do u need for one waterfall?

    If a layout has just a few short waterfalls, then sure, you can just copy paste animated Sprites all over and call it a day. (I did this in my game. )

  • I see someone have already mentioned of using the easier particles system already. but if in case that you have lots of waterfalls (implying tons of particle instances on screen, your game's framerate might drop to a crawl especially if this is on the weaker mobile devices.

    If you don't need to optimize, stop reading. But if you do need to optimize, this is another method that uses far fewer instances although also more complicated:

    You can have animated Tiles via event sheet using layer switching method:

    What you need is to create multiple Tiles with respect to number of frames you have. (ex. waterfall_1, waterfall_2 up to waterfall_n, where n is total number of animation frames you have) Put all of these in an unused layout.

    Then, in the layout, create number of layers with respect to total number of waterfall frames you have (ex. "waterfall_layer1", "waterfall_layer2" up to "waterfall_layerX")

    Now, create waterfall_1 at where you want these waterfalls to be on layer "waterfall_layer1".

    Now, on start of layout event, you check through all waterfall_1 Tiles using For Each loop, and do the following:

    • create waterfall_2 tile on layer "waterfall_layer2"
    • create waterfall_3 tile on layer "waterfall_layer3"

    ...

    ...

    (do this up to the last waterfall tile and last layer)

    Now, create 2 global variables called "waterfallstep" and "modwaterfallstep" and set them to 0 and create another global variable called "totalnumberofwaterfallframes" and set it to the number of total animating frames you have for your waterfall.

    Now, create "every 0.1 sec." event , where u will increment waterfallstep by 1 and set modwaterfallstep using this formula:

    modwaterfallstep = waterfallstep % totalnumberofwaterfallframes

    Because of the % modulo operator, this formula will only yield increasing number from 0 to number of waterfall frames you have and then the increasing number will be thrown back to 0 thanks to % modulo operator.

    Now, after the action above, you use for loop i = 1 to totalnumberofwaterfallframes. In this loop, you do this:

    if (i = modwaterfallstep), set layer "waterfall_layer" + i to be visible.

    Else set layer "waterfall_layer" + i to be invisible.

    This means, in "every 0.1 sec" event, the event sheet will go through all of your waterfall layers and will make the only one unique layer that is equal to modwaterfallstep to be visible, while all other layers are turned invisible.

    This will give you the impression of animating tiles. It is a lot more work and hectic, but you can waterfall as long as you like without affecting performance (unlike using particles). All of these waterfall tiles are also not iterated through in every tick (unlike particles as well). Therefore, there won't be much of any performance cost here at all.

  • On NW.js, you could write/read this information to another file yourself, using the NodeWebkit's functionalities:

    [quote:26w722xb]

    Action:

    Write file

    Write a text file to the user's local system. If the file does not exist, it is created. If the file already exists, its content is overwritten.

    Expression:

    ReadFile(path)

    Open the given file and return its text content as a string. Note that each time this expression is used the file is opened and read from disk. Therefore if the expression is used twice, the file is opened and read twice, which can impact performance. If necessary first read the file to a variable, then reference the variable multiple times.

    Alternatively, I believe you could also write/read such data using LocalStorage: https://www.scirra.com/manual/188/local-storage

    For the system time, you may need to use this: plugin-system-date-and-time_t63492

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Possible but not so straight forward.

    first, see https://www.scirra.com/tutorials/624/te ... box/page-1

    I don't know whether you can truly do all the HTML charade like in regular website on the textbox of C2 alone. If it's possible, that would simplify your problem quite greatly.

    Nevertheless, with respect to the tutorial above, what I would do is creating a Sprite Font that has two colors in it.

    For example, you have the default black letters and red letters. And refer to the red letters in the "character set" [1] by using unicode characters such as ⒶⒷⒸⒹⒺⒻⒼⒽ [2] .

    Also, continuing from the tutorial above in this case, in the event sheet, you would want to check for the text input and see if the input has any matches with certain strings that you want. You will then replace all the characters in such string with their alphanumeric counterparts. Now, you will have certain red words or phrases in your text. It's quite hectic and lots of works.

    Perhaps somebody could suggest a more elegant way?

    [1] - from Sprite Font, C2 manual:

    [quote:ry7dsweu]Character set

    A string of characters that describes the sequence of letters in the sprite font image. This is used to map text to images. While the default starts with the English alphabet, it could be changed to another language or sequence and the image updated accordingly. Note however the Sprite Font can only display characters that are in the character set; any characters not in the character set with a corresponding image will appear as an empty space.

    [2][quote:ry7dsweu]Enclosed Alphanumeric from https://en.m.wikipedia.org/wiki/Enclosed_Alphanumerics

  • Without Canvas+,

    I just tried connecting some bluetooth joystick to my Android phone. I see my C2 game could register button presses responsively but it couldn't register any of D-Pad and the analog sticks. So it somehow got partial support by default.

    Also, I tried http://html5gamepad.com/ on my smartphone and see that my bluetooth joystick could send signals to it. However, the gamepad testing site could not receive R3 analog stick, D-Pad, L2 and R2 button presses. It could receive L3 analog sticks fine though.

    All these joystick charades on smartphone don't seem to get all the proper love, I feel... this is unfortunate.

    But with Canvas+, can you try test and tell us the result, TecenGOD?

  • Why don't you just create another gray box when the text appeared?

  • From the manual on gamepad:

    [quote:124ddlv2]Most mobile devices do not have a physical socket to connect a controller to. Therefore Gamepad input can usually only be used with desktop computers. For mobile devices with touchscreen input, focus on designing touch controls.

    Still, nowaday, there are bluetooth joysticks that allow you to play a few games that support gamepad.

    Nevertheless, have you tried C2's gamepad plugin and tried run the game on the smartphone? Does the game respond to the gamepad input?

  • What platforms is this game to be played on?

  • When you said "heavy", how many Megabytes are we talking about here? Are they actually negligible by modern system?

    I'd say stick to the method you are most comfortable with until it no longer works.

  • That else there only works when CurObjet is not 151 because it is only followed by that CurObjet = 151 clause.

    To do what u want, add another else at the CurObjet = 151, so

    CurObjet = 12

    ...

    else

    CurObjet = 151

    ...

    else

    ...

  • Hi guys,

    Is there a max game save size on Node Webkit?

    From https://www.scirra.com/manual/188/local-storage :

    [quote:6g546lpw]

    Storage quotas

    To prevent abuse, most browsers implement a storage quota, which is a maximum amount of data that can be saved locally. On most modern browsers this is at least 50mb. If the quota is exceeded, the On error trigger will fire.

    But on NodeWebkit, what is the limit and can it be increased? Does this also affect the built-in save feature of C2 or is it a separate storage?

  • One possibility:

    You have to create an image for all numbers 0-9, and also create images for when the numbers are rolling. Do you want just several frames of quick speedy animation (which the player couldn't see what the number is) OR do you want to create the frames showing the gap between each number? This is all entirely up to you.

    You will have a Sprite called "Digit" which has 2 animations: "stillNumber" and "rolling".

    "stillNumber" will have 10 frames, frame 0 has number 0. Frame 1 has number 1. And so on until 9.

    "rolling" will obviously have the frames of rolling numbers.

    Create an instance variable called "index" for the Sprite Digit. Now, clone the sprite until you have 6 instances of sprite Digit. Line them up in a row just like what you posted. From the rightmost Digit to the leftmost Digit, assign a running index value starting from 0 to 5 to its variable "index". So the rightmost Digit will have "index" of 0. The second rightmost Digit will have "index" of 1. And so on, until the leftmost Digit which will have "index" of 5.

    In the event sheet, you will refer to each Digit using the variable "index", using For Each (ordered). You will have to refer to the number variable you want in this loop and pick out the particular digit from such variable. You can acquire just the nth digit of an integer variable by dividing it by 10^(n-1), floor the result and do modulo operation (%) on it with value of 10. For example, getting the 3rd digit of 98765: floor(98765 / (10^2)) = 987 --> 987 % 10 = 7. Thereby, you get number 7 which is the 3rd digit of number 98765. From here, you can map these values you get with the "stillNumber" animation frames.

    However, one part still remains and that is the rolling part. The paragraph above is simply for mapping number to be shown correctly, but for aesthetics of rolling number, suppose the integer variable you are referring to is changing, you could make it so the Digit changes its animation to rollingNumber for a brief moment before turning into "stillNumber" animation once again. But for this part here, how the rolling numbers should look like exactly when the referred variable change around is entirely up to you.

    Follow everything so far?

    -----

    Above is just one possibility, and it has its own pro and con. But does this fit your bill?

    Also, if anyone can come up with something simpler, please do share.

  • TiledBackground? Are you using only 1 TiledBackground object and extend it long? In that case, you will still have only 1 TiledBackground to collide with.

    Can you tell us your big picture? What are you trying to achieve?

  • Do you want the numbers to give impression of rolling up and down just like what you posted too?