Waltan's Forum Posts

  • I might be wrong about this, but, if the canvas resizes, ViewportLeft might not always = 0.

    You could try making your own ViewportBottom. I think it would be something like scrolly + (WindowHeight/2). This might not work though if you are using a layer with a parallax of 0.

    But anyway, what is the problem with this logic? These viewports could take any values, but it must always display my button on a position I entered. Top works, Bottom is not, why?

  • I have some interface buttons. They are bounded to viewports values like this:

    Those, which lined with red color, adds some value to ViewportTop, and the green one substracts from ViewportBottom.

    Here is the code:

    (Layer #2 is an "interface" layer with 0 X and Y parallax)

    It works fine in default Construct 2 preview (without Fullscreen), but this is what I got on mobile devices (with Fullscreen on, of course):

    It is obvious, that ViewportLeft and Top are always = 0 in this case, so there might be no problems with adding some values to 0. Seems like there IS some trouble with substracting from ViewportBottom, which is always different, BUT ViewportRight is always different too, but it works well.

    I cant get what is wrong. Please help!

  • UPDATE: I just realized you said layer scaling, not layout scaling, which my original info referred to. Refer to the manual entry for touch. X and Y don't adjust for layer scaling/rotation/what have you unless you give it a layer as a parameter. For example:

    Touch.X(0)
    Touch.Y(0)[/code:2crfrhp9]
    Gives you adjusted touch coordinates for layer 0.
    
    As for the number length, you absolutely should not worry about that.  There's no extra work processing a high precision number like that vs. a rounded number, so long as internally they're stored as the same type(which they almost certainly are).
    

    Thanks alot!

  • Here is a gif, explaining what I mean.

    How do I adjust touch coordinates, to create these 4 colored blocks on correct positions considering the layer scale?

    Also, should I worry about long numbers like this one?

    How can I make it shorter? round() will round this number to 1 (because scaling takes value between 0, 1 and 2).

  • bump

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Im using CocoonJS export for my Android game.

    When I tap "back" button on my tablet, system asks me if I want to exit. This happens on every layout.

    I want to change it.

    How do I get access to the system device buttons and change its actions? For example, to create my own in-game context menu, which can be called with "options" button, and returning to the previous layout with "back" button.

    Or maybe I can just turn it off?

  • Every sprite has "Z-Index expression".

    If you want to check "corner to corner: you should check if their X, Y coordinates and width and height are the same.

  • Here is two sprites with same image:

    Exported project sprite sheet:

    You can check anything you want like that by exporting htlm5 website and go to "images" folder.

  • > Have you tried to change Fullscreen in browser to Scale inner?

    >

    One question more, do you know if c2 have a fuction with similar result to this:

    I can't say for sure, but try some of these actions in browser plugin, maybe it will help:

  • Have you tried to change Fullscreen in browser to Scale inner?

  • You should use Array, to contain data of levels scope.

    Then, you need variable, to get data from array (CurrentLevel)

    Formula of changing bar's (healthbar, manabar, expbar...) size is very simple:

    Width of your bar / Value you want to reach * Current Value

    So,

    Then, if value of your CurrentExp is greater or equal to scope, you need to make a little check:

    For example:

    Array:

    x1 = 240

    x2 = 580

    CurrentLevel = 1 (So the scope is 240)

    CurrentExp = 260

    It will:

    • check if CurrentExp > Array.at(CurrentLevel) (260 > 240)
    • set CurrentExp to CurrentExp - Attay.at(CurrentLevel) (260 - 240 = 20)
    • add 1 to CurrentLevel

    You will get level 2 and 20 exp with it

    I hope I have explained completely enough

  • That's what 'Request URL' does.

    Oh, that's right. Thanks alot.

  • For example, I have 100 levels in my game, and these levels are in .json files, attached to the project.

    If there is any way I can request these files with AJAX by name, not by choosing it from list?

    Like this:

  • bump

  • Keyboard object has no actions. How do I simulate action of some combination?

    I want to make automatic text saving to clipboard. If there is no way to just put text in clipboard ( discussed here ), then I want to try this trick:

    1. User presses "Save to clipboard" button

    2. System focuses on a hidden textbox

    3. System simulates "Ctrl + A" combinaion

    4. System simulates "Ctrl + C" combination

    Done!

    What do you think? If it possible to make?