Guizmus's Recent Forum Activity

  • Just to be sure that your gamepad can be detected by your browser (if it's not the case, tier party software like Joy2Key are the only solution), open the console (F12) on any chrome or Firefox page, enter this code, and then connect your gamepad. If the browser detects it, it will alert "Detected", and won't do anything otherwise.

    It should also, on detection, log the gamepad object, more infos on it can be usefull.

    function onDetected(g) {

         window.alert("Detected");

         console.log(g);

    }

         window.addEventListener("webkitgamepadconnected", onDetected, false);

         window.addEventListener("MozGamepadConnected", onDetected, false);

         window.addEventListener("gamepadconnected", onDetected, false);

    (Thanks Ashley for the code, it's a copy past from the gamepad plugin)

  • Well yes, it's only a debug panel, outputing ID for keys pressed on the gamepad. I changed the capx a little to add detection of adding/removing a gamepad. It should also give you the detected name, witch is needed for the configuration.

    I hope somethings outputs this time ^^ Can't help more if it doesn't

    Cya !

  • iOS just uses any <input type='file'> as a button to select an image from camera roll or by taking new picture (at least it does so in a web page, I don't know how it reacts in an application, should be the same).

    The filereader plugin will then help you, as it triggers exactly what you want.

    I had some problems with the plugin though and had to twick it a little to add possibility of hiding/displaying the <input>.

  • You can always look at "len(SaveStateJSON)" in the "On save complete" event, I don't think you can get it anywhere else though.

  • I'm more of a web developer than an artist, so it helps ^^

    I don't have any D-Pad to test and help you though, so I would have hard time here ...

    Here is a capx to test if any input is detected. Just try to use it and see if a debug appears. If so, you should try to associate an ID (displayed in the capx) to every button, and then we could try to map it with a custom plugin.

  • EDIT : I wrote this supposing that the browser detected the gamepad. If that's not the case though, I don't know how to do it.

    Hey !

    It just seems to be a mapping problem.

    Here is some help that can be found in the runtime.js of the gamepad plugin :

         How to write a mapping:

         Construct 2 normalises all controller states to the format used by the XBox 360 controller

         on Chrome/Windows. Everything is mapped to a single 20-element array in the format:

         0: A                                        10: Left analog button

         1: B                                        11: Right analog button

         2: X                                        12: D-pad up

         3: Y                                        13: D-pad down

         4: Left shoulder button              ?14: D-pad left

         5: Right shoulder button              ?15: D-pad right

         6: Left shoulder trigger              ?16: Left analog X axis

         7: Right shoulder trigger          17: Left analog Y axis

         8: Back                                   18: Right analog X axis

         9: Start                                   19: Right analog Y axis

         Since different controllers return buttons and axes in a different order on different

         browsers and OSs, all combinations need to be mapped to the above 20-element array,

         called the 'c2state'.

         The buttons mapping array translates a raw button input to the c2state, and the axis

         mapping array translates a raw axis input to the range 0, 1, 2 or 3 (automatically offset

         by 16 to fit in to the c2state). However, sometimes an axis is mapped to a pair of buttons,

         e.g. for the D-pad coming up as an axis. In this case the mapping is another array

         of the buttons to map the axis to; the first element for the button when axis negative,

         and the second element for the button when the axis positive. e.g. XBox 360 on Firefox/Windows

         has axis 5 mapped to D-pad left and right; the entry is [14, 15] to map negative (left) to

         c2state 14 (D-pad left), and positive (right) to c2state 15 (D-pad right).

         If no mapping exists for an OS/browser/controller configuration, it defaults to assuming it's

         the same as Windows/Chrome/XBox 360, done by the defaultMap function.

    And here is the mappings already set in this plugin :

         var win_ff_xbox360_buttons = [0, 1, 2, 3, 4, 5, 8, 9, 10, 11];

         var win_ff_xbox360_axes    = [0, 1, [7, 6], 2, 3, [14, 15], [12, 13]];

         ctrlmap["windows"]["firefox"]["xbox360"] = function (index, isAxis)

         {          

              return doControllerMapping(index, isAxis, win_ff_xbox360_buttons, win_ff_xbox360_axes);

         };

         

         var win_ff_lda_buttons = [2, 0, 1, 3, 4, 6, 5, 7, 8, 9];

         var win_ff_lda_axes    = [0, 1, 2, 3, [14, 15], [12, 13]];

         ctrlmap["windows"]["firefox"]["logitechdualaction"] = function (index, isAxis)

         {          

              return doControllerMapping(index, isAxis, win_ff_lda_buttons, win_ff_lda_axes);

         };

    For a debug purpose, I would edit the runtime of controler, and add a console.log in getMapper (function(_id)) (line 132), just to see what input you get from your D-pad, and then prepare a mapping just like the two I just paste above. If your specific gamepad isn't supported, I don't see any other way.

  • I asked myself what version to choose not so long ago and went with the website one for 3 reasons :

    1/ I sometime use C2 at work for personal interfaces, and couldn't install steam there.

    2/ I like to keep up with the beta version, and didn't see this option in Steam.

    3/ Steam didn't let met use multiple instances of C2, wich was useful for writing plugins.

    I didn't understand the minor difference in pricing though. Maybe it's because of currency exchange rate, but C2 was about 3? less on steam than on scirra.com.

  • Well, I didn't know the answer so I tried out a little example with debug just to see the order. 3 objectTypes, 6 objects, 1 family, and a forEach on the family. : capx

    The result seems to prove that :

    • elements UID in the family is correct
    • elements IID in family are not the "family IID", but the different IID of the objects, as if there was 3 pack of items, classed by object type.

    So using the IID in your case can be tricky, and using the UID and function instead could help, yes.

    Here is a function that could do the trick, simulating a "pick Nth object" for a family. Problem is you have to rewrite it for every family...

    <img src="https://photos-3.dropbox.com/t/0/AAAEfxtcRQmfJerPEgeVZvytQb3pJEaZXoQQ7euyTl2Vrw/12/113235847/jpeg/1024x768/3/1372237200/0/2/pickFamily.JPG/SEtxKiIgNsraMnJOeo4vY5ZMEqz69dchdmqkkXFQatI" border="0">

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I had that problem before with a userscript pulling datas from host I didn't own. I used YQL, an API you can pull data from by sending a GET request in an SQL style, the database being the web. Of course it accepts cross domain. It's a little slow sometimes though, but it gets the job done. A trick can let you query with post data too.

  • DoudouSupreme

    I re read my post, and wanted to explain the use of recursive functions (event 6 and 7 calling themselves X second later). I use it mostly for periodical effects. Imagine you want the enemy to stop chasing the player if he ... I don't know, wants to take a nap. You can had a sub event

    If enemy.stomach < 5 -> callFunction findFood

    Else -> do the chase again

    Can be used for debuff too, or other things :)

  • OK, so I corrected what wasn't right and here is a functional capx.

    One or 2 observations though :

    • for the background, why do you use a 800x800 PNG ? Use a 32x32 one, in a tild background, and set its size to the size of the layout, that's a lot of memory free. (and the file is now 140ko, not 2Mo)
    • i've put in my capx a lot of instance picking by UID, to help you understand it.
    • I've gotten rid of every "every tick" and "every X sec" events using recursivity in functions. It's a nice technique to use in my opinion, and more FPS friendly.
    • use the ScrollTo behavior for your player, not an "every tick, scroll to PC" ^^

    <img src="https://photos-3.dropbox.com/t/0/AABtYT8MO2FfHXnH_frYkn2IltbJr4IN_hHam1bm8kWesg/12/113235847/png/1024x768/3/1372186800/0/2/LoS.PNG/PoR6-IHL1-ZjoIFilmUvpJSF-XMm2lMIO_eBw9zdMnA" border="0">

  • Hey !

    I'm having some hard time upgrading my projects ... Lots of object types, lots of events, it's starting to be hard to browse through. So I started to make groups, name my functions well, ... but before taking bad habits, I wanted to know how you do it, if there are some common behaviors among C2 users here, or if I just need to find my "style".

    Here is a example capx of the organisation I tried in my towerDefense try, but I realise that this kind of organisation is time consuming and problematic if I want to change some game mechanic sometimes...

    Thanks a lot for the feedback, I know this is not the usual questions around here !

    PS :

    Hum, my project is heavily relying on rexrainbow's plugins... If you want to look at it you'll need CSV, timeline, TMX importer at least.

    Here is a screen of what it looks like in the code

    <img src="https://photos-5.dropbox.com/t/0/AACe412Yc4kl5OPH3YR0oQ_WIMO5BUghfEQyEdz5IX7Umg/12/113235847/png/1024x768/3/1372183200/0/2/TD.png/o8wdcAdaZQxuuWPs3kad2WDKTBIx0B3IbJiMFwghtJM" border="0">

Guizmus's avatar

Guizmus

Member since 26 Mar, 2013

None one is following Guizmus yet!

Trophy Case

  • 11-Year Club
  • x4
    Coach One of your tutorials has over 1,000 readers
  • Educator One of your tutorials has over 10,000 readers
  • RTFM Read the fabulous manual
  • Email Verified

Progress

15/44
How to earn trophies