vishymuku's Forum Posts

  • Hi,

    Has anybody tried hosting the games developed in Construct 3 in a web application built with Vue JS?

    Or any javascript framework like React or Angular which make use of components.

    Basically, I will need to load the game in a single page component.

    If yes, any guidance for this will be of great help.

  • Did my check:

    Chrome 36.0.1985.125

    Windows 7 64bit

    Construct2 r168 game with sounds

    Ran perfectly. Please let me know if I need to test on something else too to be sure.

    the game is not intended for mobile platforms, so I didn't check the android version of chrome release.

    Cheers,

    Vishy

  • Hi Ashley,

    Thanks for the vital info. I have starred the bug post. Last count I saw was 30 stars.

    I'm using r168 for my current project. I have modified the Facebook plugin to suit the project requirements. Hence the reluctance to upgrade to newer stable releases, till the project is finished.

    Will this bug affect r168? I'm sure there'll be a definite answer to this question when the said "date range" is pinned. But if there's a ready answer that 2014 releases won't be impacted, it'll put many a soul to ease

    Cheers,

    Capper

  • by breaking up the steps I get

    [attachment=0:1w5g6hb4][/attachment:1w5g6hb4]

    Thanks for this RamPackWobble. It works!

  • Hi!

    Use the System Stop Loop.

    Manual reference here

    https://www.scirra.com/manual/125/system-actions

    Hi AbelaNET,

    Thanks for the suggestion. I have gone through the manual.

    I have also mentioned in my post that I have used "stop loop". It did not work for me.

    I think stop loop will stop the next iteration of the loop. It will not stop executing the commands in between.

    Cheers,

    Capper

  • Hi Guys,

    Representation of my Loop Problem:

    Variable X,Y,Z = 0

    Condition 1: Repeat 10 Times

    Condition 2: Y < 100

    Add to X 20

    Add to Y 50

    Add to Z 100

    What I want is to exit the loop when Y becomes 100, without executing the 3rd Action (Add to Z 100)

    The Desired result is:

    X= 40 (Action Add to X Executed twice)

    Y=100 (Action Add to Y Executed twice before the condition fails)

    Z= 100 (Action Add to Z executed once since the condition failed)

    The Result I get from Construct2:

    X=40

    Y=100

    Z= 200 (All 3 actions in the loop were completely executed before checking for the condition)

    I have tried different approaches- None of them worked:

    1. Outside loop, I've set System Event to "Stop Loop" if Y >=100

    2. Outside loop, I've set System Event to "Deactivate Group" in which loop is if Y >=100

    Now I understand that all the actions will be performed before checking the condition for loop.

    My Question is : Is there a way to exit the loop without performing all actions when a condition is met. To solution I'm looking for is as follows:

    Repeat 10 Times

    Add to X 20

    Add to Y 50

    IF Y >= 100 Exit Loop

    Add to Z 100

    Is this possible through Construct2? Or do I have to code it in Javascript in C2runtime.js?

    This is simplistic representation of the problem I have at hand. I want to apply this logic to show user's friends' photos dynamically in a facebook game.

    Any help will be much appreciated.

    Thank you.

    Capper33

  • Use a compare condition function. param (0) = 1.

    Hi Makotto,

    Thanks for the suggestion. I have been able to solve the problem with Nimos's Help

    Cheers,

    Capper

  • [quote:11xzk8au]Having said that, I believe, the error in my approach is the way I am comparing the Function parameters.

    Would be great if you can clarify on this part.... or correct my approach.

    Your approach and code is correct. Your problem is that you try to assign a string to a int variable. In your function you return "Even" or "Odd" but the result requires an integer. So if you change "result" to a string it should work.

    hahaha. What a stupid mistake. Thanks for pointing it out. This will get me going again on my learning...

  • This might help:

    Hi Nimos,

    Thanks for the quick response. That's a very clear and detailed explanation.

    I have understood the basic structure now.

    Having said that, I believe, the error in my approach is the way I am comparing the Function parameters.

    Would be great if you can clarify on this part.... or correct my approach.

    Cheers,

    Capper

  • Hello Guys,

    My problem is that I'm not able to understand how to use functions: Pass a value, do some checking and return a value based on the checking. To keep things simple, I have created a simple scenario: Attached the image.

    If Purple sprite is clicked, the variable "clicks" is incremented.

    If Blue sprite is clicked, I am calling a function and also passing the variable "clicks"

    If clicks = 1, I want the function to return "odd"

    If clicks = 2, I want the function to return "even"

    The logic I used returns NaN.

    Please check the image and let me know my errors.

    In this example, I know that we can achieve the desired result without functions. But this simplistic representation is for a complex problem where I have a 16X6 array and I want to set the value in y=5, based on the range in which Y=4, values fall for each row of the array.

    I have read the Manual, and searched the forum for some examples. But the queries are all very advanced. I need some basic info.

    Please do help.

    Thank you

  • Hi,

    Using the plugin is very complicated. You have to create a fresh plugin for this to work.

    You have to manually create Actions / conditions / expressions in runtime.js and edittime.js in exporters/html5/plugins/facebook folder. For this approach you can check the following tutorials written a long time back:

    https://www.scirra.com/tutorials/445/facebook-how-to-get-a-list-of-friends

    https://www.scirra.com/tutorials/446/facebook-how-to-invite-a-friend

    If you find it difficult, the alternative, I think is to custom update c2runtime.js in the exported app folder.

    This is the process I followed:

    1. Use browser object in the project

    2. In the event where you want to invite friends, set the action "go to URL". In the URL field, enter any identifiable text. For Example "Haider Is Great"

    3. Export the project to HTML5

    4. Open C2runtime.js.

    5. In C2runtime.js, define your own JS code to request FB for "invitable friends" and Creating a Multifriend selector

    6. In C2runtime.js, search for Haider Is Great (cntrl+f). Here you'll find "Got to URL" function.

    7. Replace "Got to URL" function, with the function name you created.

    On top of this you'll need send request to friends also.

    Looks complicated. But it is simple. The code examples are available on Facebook developers document pages.

    You'll need to go through the following:

    1. Canvas game tutorial (will give you code for sending friend requests)

    2. Invitable Friends - this is a new feature and it is very useful (will give you necessary code for getting the friend's list)

    3. Multi-Friend Selector - (will give you code for creating menu to select the friends to whom request has to be sent)

    Let me know if this is helpful.

    I'm not a programmer, but I know that my JS developer implemented this in my project.

    If possible, I'll post screenshots of this process later.

    Cheers,

    Capper

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Hi Kyatric

    Do you think this qualifies for this topic? I have seen some guys asking for examples for Facebook - Leaderboards. I've included screenshots in the solution (not very professional though), to help those who want to build leader boards on Facebook games.

    note: I'll not pester you if you say NO

    Category: Plugins

    Sub-Category: Facebook

    Question: How do I create Facebook Leaderboard

    Link: https://www.scirra.com/forum/how-do-i-quot-facebook-top-10-scores-quot_t103763

  • Hi,

    I have got a working solution. This will work only for leaderboard among friends. It will not show a world-wide leaderboard. This is because, if the call for scores is initiated from user, Fb will give only the user's friend's scores.

    I think clay.io plugin should help if you want world wide leaderboard. Please check this tutorial if it helps:

    https://www.scirra.com/tutorials/495/how-to-make-a-custom-leaderboard-and-more-using-clay

    I haven't used clay.io, but, I store every user's score on my server and display the world leaders on a separate page.

    Attached screenshot of events sheet.

    Logic:

    Create arrays to store High score data (I have used 2 arrays - one for name and one for score)

    Create global variable for Array indexing. ('i" in my example)

    1. Call "Request hi-score board"

    2. Set the number of scores you need - 10 in my example

    3. Use "On hi-score" to populate the arrays. Note that "On hi-score" is triggered once for each score record received. Hence if you ask 10 scores it will be triggered 10 times. For each trigger we are incrementing the index (i) and storing the data in the respective arrays.

    4. After that we display the scoreboard in different text boxes. I used 20 of them.

    IMPORTANT CHANGES TO BE MADE TO c2runtime.js

    1. In FB.init add "Version": "v2.0",

    2. js.src link change all.js --> sdk.js

    3. RequestHiscores function def add '/v2.0/' after FB.api(

    4. You have to update "channel.html" with point 2

    These are for changes due to Facebook platform upgrade.

    I have attached screenshots to illustrate all these points.

    Possible improvements:

    I think one array could be used... maybe

    2. all the fb related changes may not be necessary

    Food for thought....

    If you have less than 10 friends who have played, then "On hi-scores" will be triggered exactly for the number of players only. It will not trigger all the times. So the array will be filled partially. (to be explored: What if we have more than 10 friends and we want to dynamically display the exact number of friends who play the game???)

    Let me know if this helped.

    I'll be glad, if some experts can offer tips on optimizing what i've done.

    Cheers,

    Capper

  • Hi isasaurio,

    I'm also looking for the same solution.

    You can use: "Request hi-score board", from Facebook object. When you use this, you can also specify the number of top scores you want. So if you set the number to 10, we should get the top 10 scores. Please note: This will work only if user has given the "publish scores" permission.

    This much, I could understand from the Manual. But I don't know how to display the Array response from Facebook.

    I'll crack this today and let you know if I am successful.

    Please note: There are some major changes to permissions from Facebook. This happened with new version release on 30th April 2014. It'll be helpful to review them.

    Cheers,

    Capper

  • Hi Guys,

    I'm a newbie. Wasted half a day trying to resolve something because I was not up to date with changes in Facebook.

    Please ignore this if you are aware of this upgrade on Facebook. My intention is to post this for other guys like me, who always look for support from these helpful forum posts.

    I just ran into a problem (sourcing invitable friends - friends who haven't signed up for my app) while working with a facebook app, and found out that Facebook platform has been upgraded, and that apps need to make changes to interact with FB.

    Please check the link:

    https://developers.facebook.com/docs/apps/upgrading

    Important points:

    For apps created before April 30th 2014, making API calls without specifying a version number is equivalent to calling v1.0 of the API.

    For apps created on or after April 30th 2014, making API calls without specifying a version number is equivalent to calling v2.0 of the API. These apps won't be able to call v1.0 of the API.

    Version 1.0, which is what we call the API as it existed the day before v2.0 was launched. We'll support v1.0 for one year and it will expire on April 30th, 2015.

    Version 2.0, which is what this upgrade guide covers. Version 2.0 is supported for at least two years. At the earliest, it will expire on April 30th, 2016.

    You can choose which version of the API you want to use by:

    Initializing the JavaScript SDK with the version you want to use and then making calls through FB.api(), which will automatically route API calls to the versioned endpoint you choose.

    Integrating the Facebook SDKs for iOS or Android, which are set up to call the latest version of the API that was available on the day the SDK was released.

    For people making manual calls to our API without an SDK, the version is picked by putting the version in the path when you make an API call (such as graph.facebook.com/v2.0/me).

    runtime.js for Facebook plugin may need to be updated

    js.src = "//connect.facebook.com/en_US/all.js";

    You should update it to:

    js.src = "//connect.facebook.com/en_US/sdk.js";

    Add "version : 'v2.0'," to FB.init

    Cheers,

    Capper