Toby R's Recent Forum Activity

  • Just checked it out quickly. Indiegogo does not allow cross-domain "grabs", so you can't fetch this data with AJAX. I'm afraid there is no other way in C2 to download remote data so you need to make a work-around.

    1. Create your own server side script which will download this JSON from Indiegogo (using CURL or whatever) once triggered and simply output it's content (kind of intermediary script).

    2. Set your server (or script) to allow AJAX fetch data from the different domain.

    To do that you can set Apache with .htaccess

    <IfModule mod_headers.c>
    Header set Access-Control-Allow-Origin "*"
    </IfModule> [/code:2s3jho53]
    
    3. Since you do the server script anyway, I would parse the JSON data already in that script and output only the number you want to fetch in C2.
    
    4. Now in C2 you just make a simple AJAX request as below:
    [img="https://i.imgur.com/4zjAltY.png"]
  • You can fetch web-api data with AJAX object and then load it into Dictionary so you'll be able to grab any part from JSON easily. But to load it into a Dictionary you need a specific JSON format.

    Here's a snipped from my lib. It's PHP but I'm sure you get the point.

    So you have to change your web-api output or parse the fetched sting in C2 before loading into Dictionary. You can use regular expressions as well.

  • Just a quick idea.

    1. when On Jump condition triggers, save current player.Y to some variableY

    2. adjust lerping camera conditions so when player "is jumping" (there is such condition) then camera lerp Y cords to the variable Y, otherwise lerp to player.Y

  • gumshoe2029 Yes that's me on the picture .

    Thank you for your offer but I am full time bussy now and accepting only small tasks which I do after "day job" hours and a bit on the weekends so I'm afraid I can't help with any big thing now.

    Anyway good luck with your project!

  • Hi tutbarao

    Yes there are some Chromium settings which you configure in the config xml. It is covered in the e-book, but if this is the main part that interest you then please read my tutorial How to build optimized Intel XDK Crosswalk app properly?.

    I have covered this part there as well.

  • Just took a look on my Airconsole game statistics, thought you might be interested in seeing how it goes on their side.

    As you can see there were thousands of plays and hundreads of hours played. Note that I do not advertise this game anywhere anymore, those are almost clear statistics from AirConsole traffic. I must say it's pretty impressive. Numbers are really high as for a game which is not featured on their platform (maybe it was during the peak you see on the graph, but I haven't checked it that time).

    I got permission from AirConsole team to implement a Google Play link (to my Google Play version of this game) to the AirConsole controller. The conversion rate is around 1,5% (1,5% AirConsole players have installed Google Play version). I was expecting higher conversion rate, but still it's a decent way to grab some downloads. Especially that once AirConsole starts showing ads on their platform, you (as developer) will get a 75% (if I remember well) income from the ads.

    No particular reason I post this, just thought it might be interesting info for you.

    Cheers

  • > FYI, Regular global variables have rather huge security issues.

    >

    What exactly is meant by this?

    Simply saying global variables (no matter on the language/technology) are available even from outside the project. They are simply global. In JavaScript it goes to kind of global namespace and can be accessed by someone (man or other script) who was not intended to use is.

    You can google a lot about security risk regarding global variables in various languages. But apart from security issues, global variables, functions, ... are the exact opposite to encapsulation which is the essence of good programming practices.

    Just quickly googled "JS good practices" and the first on the top which popped up is http://www.w3schools.com/js/js_best_practices.asp

    Almost at the very top it is written with big letters "Avoid Global Variables" <img src="{SMILIES_PATH}/icon_e_wink.gif" alt=";)" title="Wink"> - haven't read the article tho.

  • Well the OP wanted a method so he doesn't have to repeat the same code over and over. Because a global variable isn't encapsulated , then he can just call it easily whenever he needs to without having to repeat code over and over.

    The only thing in my opinion that brings a mess to a large project is not writing down want you want 1st. Before I take on a larger game I write down in notepad the different scenarios and things I want in the game. That way I don't get stuck in the middle because I calculated what I was going to do.

    Initially you can make a brief plan in notepad, but this isn't a solution for further development. There is a saying "There is no project which is finished". Also you cannot predict everything for a big project no matter how good developer you are, so again - notepad is ok but only as initial draft.

    As lennaert said - apart of a mess in the project - globals do bring some security issues. So instead of using globals you should encapsulate your code with groups and functions and use only local variables. For toggeling particular functionality you should not use global variables states but simply toggle groups or object's instances booleans - depends on your need.

    What we are talking about is - I would say - the highest art of development which is the code architecture (which also relates to semantic). It's quite difficult for beginners but it's the most beautiful part of all development process. Many experienced developers, after years of work as a developer, decide to be so called Technical Architects/Analysts. In short words they are responsible for keeping the project structure the way it should be the pro way to avoid various issues in later stages of the projects.

  • 1) Make a global variable =0

    2) make a function or multiple functions

    3) When the global variable =1, then trigger the functions to be true.

    4) Dont forget to include the event sheet with other events sheets.

    Easy as cake!!

    I strongly suggest to avoid global variables as much as you can if you plan to do a big project. Global variables bring mess to the project and block the possibility of encapsulation. It is already a pain in C2 that all functions are global.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Reusability is the essence of development in some way. I mean it is really important and it is a serious issue if you can't make a reusable code in the engine so I understand the frustration. Every experienced programmer always keep in mind to make that feature which he is already working on a kind of universal/reusable code (lib, plugin, module, ...). Reasons are obvious.

    As it is not that stright forward to make a reusable code in C2 - still it is possible. My MoModth project which I talk about from time to time is based on (what I call) modules. Depends on the feature a module can be a functionality with dedicated API (both functions and callbacks) or stand alone functionality. This approach really does the job. That's why I say for MoModth that "Building C2 apps has never been easier", because you can simply attach modules which you use in current layout and they handle most of needed functionality.

    Think about it like on libraries in regular programming languages. You download a library and use it with it's API. So I really encourage to take this approach while building C2 apps. It saves a lot of time and speed up development drastically. Also once you make a good module it is already tested/working code so you don't have to bother with bugs/compatibility.

    I wish MoModth be finished already as this is a close related topic with issue that MoModth's is solving actualy. I am however very bussy recently with my client's projects so MoModth has to wait a bit.

    Anyway I assure you that C2 can handle big projects you just have to figure out your own smart coding guideline, some conventions for the project which will let you not get lost once it gets big.

    In shot: ENCAPSULATING!, organizing, optimizing and overall refactoring should be done as soon as your project evolves with some new "wing".

    Good Luck

  • Ah there it is! Thank you guys!

  • Tom, Kyatric, zenox98? Can I ask for some instructions regarding this?

Toby R's avatar

Toby R

Member since 23 Mar, 2015

Twitter
Toby R has 18 followers

Connect with Toby R

Trophy Case

  • 9-Year Club
  • Forum Contributor Made 100 posts in the forums
  • Forum Patron Made 500 posts in the forums
  • Forum Hero Made 1,000 posts in the forums
  • x6
    Coach One of your tutorials has over 1,000 readers
  • Email Verified

Progress

14/44
How to earn trophies