nutmix's Forum Posts

  • I had the same issue - how to make a modal dialog. You have to do it manually, unfortunately. Below is my experience.

    Note: there is no way to make a sprite disabled, i.e. any sprite, no mater if its invisible, or on an invisible layer, or even under other sprites not get a touch/click event.

    Here are the strategies I tried:

    1) Make a layer above your game layers, and make the layer invisible (There is a check box "Initial visibility" which you can set in the layer settings in the editor, and a check box in the layer panel to make it invisible in the editor when you are done.

    2) Put your game UI input code in one group (or a small number of groups). This group is enabled by default. Put your dialog input events in another group, and make it disabled by default (under group edit in context menu)

    3) When you want to make your modal popup:

    a) disable your game input group (System->General->Set group active).

    b) make your dialog layer visible.

    c) Enable your dialogue UI group.

    4) reverse this when you want to close the group.

    This seems to be the recommended approach, but it didnt work for me as I could not put all my UI code in one group, UI code is spread out in separate event sheets and modularized for maintainability. Also, I have many different modal dialogues, and so I ended up trying to track several groups which turned out to be untenable in a complex project (by brain is too small).

    Instead I took a different approach.

    I leave all UI components active for input (i.e. dont put them in groups). For all my 50+ input events (e.g. "touch->On touch start", "touch->On touched Start" I have a second or third condition which I check the visibility of various layers to deduce which "screen" I am on, i.e. one of several modal dialogues, one of 2 help screens, a settings screen, a game level etc. This was better, but still gave me a headache.

    The current strategy I use is to create modal dialogs within the dotted line of the layout editor, but when the game starts (On layer start), I move the contents of the dialog layers 1024 pixels to the left or right. I then "slide" in the modal screens (such as the settings page) in and out when needed like the swipe on an ipad. This keeps their input out of the way of being pressed. You cant move or animate a layer, unfortunately, so the best way is to put all the sprites in a family, then use "settingsFamily Move 1024 pixels at angle 180". The problem is you cant put text in the family with the sprites for some reason. So then you have two strategies:

    1) pin the text items to one of the sprites.

    2) put the text sprites in their own family, and always move both.

    I started off with 2), but recently Ive do all my dialogs with 1), which turns out to be more maintainable, although it does mean a lot of pin code in your "on start of layout". Its a shame you cant pin one object to another in the editor.

    For the swiping part, there is no tween or animated move to (unless you use one of the many plugins for this), the next best thing is the bullet behavior. However, this wont get the screen exactly to the required destination X, you have to either accept it being approximate, or then manually move it to the exact correct position after. I do a bit of both (if you make the dialog narrow, you can get away with the former).

    I must admit, it's more work than any other system I have developed with in the last 30 years (ok, I;m old - I wrote my first space invaders game when I was 14 on the ZX81 in Z80 assembler).

  • Here is the capx for the non working touch sprites:

    https://www.dropbox.com/s/bmjya8iefnjtjmk/alphaButtonSpriteFail.capx

    It only works if you click on the + or - pixels of the sprite which have the alpha channel set to 255.

    Any thoughts to why its not working appreciated.

    Winks idea of using a hidden object underneath is probably the only workaround, but as I move this panel left and right with swipe, I can never get the objects to light up properly after (and you cant mix text and sprites in the same family). I will try pinning the invisible button to the non working button.

    Its a bit ironic that an invisible object will catch touch events, but a visible one wont.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • yes, I go form 2x2560x1600 monitors at home to 2x 1280x800 in the company office (they are tight).

    The workaround works a treat, but requires a restart of c2.

  • Sorry, I'm talking about a sprite which is acting as a button.   Nothing I click on except the solid text part of the button will register (ill create a capx shortly).

  • All the buttons for the game are semi-transparent, so they show part of the background through (i.e. alpha of 127). The text on the button has alpha of 255 though so its nice to read.

    The problem is the on touch event for this button does not fire unless you click on the txt of the button, which is very difficult and unintuitive.

    Any ideas for a fix?

    I could drop all the touch handling, and write my own, but this is a huge pain, especially as I am sliding the text in and out (for info and settings)using the bullet behavior, and mapping the mouse position to the button positions and scaled sizes is tricky and tedious.

    Thanks for your help and ideas!

  • Hey, that worked!

    Ramones +1000 Kudos!

    Ashley, don't know if its possible for you to add a check that the dialogs are on screen/visible?

  • OK, I have the same issue with normal families.

    I expect its an issue with the dialogue being out of the window range.

    At home, I use 2x30" external minitors, in the office, I have the laptops built in panel + a small external monitors.

    I am guessing that C2 is displaying the window outside the monitors display area.

    My work around is to save the project as multiple files, and hand edit the event sheets.

  • To reproduce:

    1) create a family with just a few text items in.

    2) assign the bullet behaviour to family (speed = 0)

    3) on some event, add action

    4) Select text family.

    5) Double click "set angle of motion"

    6) now the "objects with expressions" popup appears.

    However, there is no other window present where you can just type in "0".

    I.e. you have to select an object, e.g. "system". Then you can only pick say a global variable.

    So as a work around, I had to create a global variable called ZERO and another called ONEEIGHTY etc for all the angles I needed in the game.

    However, this workaround doesnt work if there are two values, e.g. Move X pixels at angle Y, as it only pops up one "object with expressions" popup, which puts the global var in the angle, and hard codes the number of pixels to move at 1.

    I was assuming that there was another window hiding somewhere, but when I do the Aero walk thing (windows-tab) or alt-tab, I cant find any other windows.

    Any ideas?

  • Unfortunately, if it cant be fixed, I still need to find a solution or workaround - the game looks terrible in FF which is one of the most common browsers - its in the show stopper category.

    What is a good workaround strategy? -

    1) to do it in the game (e.g. use the user-agent string to try and detect FF like browsers, then subtract 6 from the Y coordinate of all text items? Its a shame text items cant be put in a family for this.

    2) to do something in CSS/HTML?

    Is no-one else using text and Firefox?

    Thanks,

  • Thanks guys, 3 strategies - I'll try webfonts first as we need to output dynamic text and numbers (which is a pain to do with sprites).

  • We have purchased new fonts for the game, e.g. VAG Round. The font is pretty key to the game design.

    These look great in preview on the local machine, but dont work on any other Pc or mobile - you just get something like Times New Roman.

    Currently the fonts scale nicely when we scale the game to fit the window, we would want to keep that too.

    Is this possible, or are we stuck with the hand full of web safe fonts like in 1999? The designers will kill me if I tell them this...

  • Wow. That viewport stuff works, thanks. I need to draw some diagrams to get my head around it.

  • Thank god you were here, I would have spent hours searching for a string function for this.

    Ive put in a ".":

    str(int(balance))&"."&zeropad(int(balance*100)%100, 2)

    Thanks again!

  • The text looks the same, its the position which is about 7 pixels too low in FF. The same project with the same layout looks fine in all browsers in R99. I have not seen this effect till 103.

    Ill create a capx.

  • If we have the players balance, which is a number set to 100 or 10.5 or similar, we want to show it as a text object to 2 decimal places. I can't find any way to do this, if you say

    Global number balance = 100

    ...

       txtBalance set text to balance

    it formats it to the min number of decimal places possible, e.g. "100.0" is displayed as "100" and 10.50 is displayed as "10.5" not "10.50"

    Any ideas?