tarek2's Forum Posts

  • Yeah, you can save your project as a folder (not as capx), and then you will be able to modify json file while the game is running in preview on mobile. If you request the file with AJAX again, it will load the updated file contents.

    Don't add any path to the file name. Use AJAX Request URL action, URL="Mobile_Test.json"

    Weird the last time I been at it for very long and I give up because I couldn't get it to work I followed the same method that you described with the capx extracted on files, and today I tried again but this Time using Nw.js to save to the Json file with the Path Method you shared for subfolders and it finally worked, so it must be the Path that I was using probably wrong

    Awesome thanks dop2000 for your help :)

    Sorry Soviet shrek for hijacking your thread

  • Thanks dop2000

    I was just making sure that it wasn't possible to do, while back after I couldn't make it work someone showed me other online option as you said but I still had the curiosity if Pc-To Mobile will work with (NW.js or Ajax)

    Another Idea I had is to work and save directly on a JSON file already imported on C2 Files Folder, but I couldn't find the Path to save directly to that Json file inside c2 while you are on preview

    Example

    while you are on preview request download JSON and link to the Path where c2 has stored the JSON file and just replace it, do you think this is possible?

    Png to explain it more visual

    basically Request Download Json >>>saving directly to this folder while the game is running

  • Interesting I was trying to do something similar no while ago and I couldn't make it work, I didn't know about the NWJS.readFile Thanks for the info.

    Still, I have a few problems when I connect the iPhone over wifi to the capx that request the NWJS.readFile("d:\temp\file.json") it doesn't work I tried many different ways but it always fails even I tried Ajax load from Url and still fails.

    dop2000 do you know of any working solution to read a file from Pc but while on Mobile Preview without using any external cloud service?

  • You could name them (Name+Number) like this

    https://www.dropbox.com/s/3e1p0l22cj4x5h4/Next%20Animation1.capx?dl=0

    or if you dont want to name the Animations with Numbers you could store them in an Array

    https://www.dropbox.com/s/j2ielubiwm0sgpv/Next%20Animation2.capx?dl=0

  • I have a membership including remote preview, But I want to be able to share my game with my friends. Non-Profit. There must be a way without paying £100.

    Gellowg Sorry, I'm a bit confuse about What is your real problem? you didn't describe what problems you having now

    You asked for:

    I know it's not easy, but there must be a way to do it without paying £80.

    I want to be able to upload it to diawi.com for ios.

    Really I only want to know how to test the app.

    You can do all that without Paying the 80 Pounds Fee as I described on my first Post so I'm not sure which problems you having now or maybe you are looking for something else?

  • I know it's not easy, but there must be a way to do it without paying £80.

    I want to be able to upload it to diawi.com for ios.

    Really I only want to know how to test the app.

    -If you intend just to Test On iPhones Devices then you don't need to Pay

    -But when it comes the Time for Release the App then you will have to Pay for the Developers Account no way around it

    I thought you could only run it on a physical device if you had signed it? Certainly xcode wont let you build to device without a code signing identity.

    Indeed that is still true, you need to add first the Devices ID Numbers to the Certificate so when you try to install it on any Device checks if that Device ID Number Matches the Ones you have on the Certificate List if yes then it will finish the Installation but if not it will just Stop the Installation.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • > How does it check which one we passed as a Parameter

    Internally this would be done with a map lookup, which is very fast (and faster than a sequence of if-else-ifs).

    Hoo Grate! that sounds really good Thanks

  • One Question that makes me Wonder

    when you >>>>Call function from "color" map with <string>

    and we have the Function with 3 Options

    On function ColorCall

    -> Map "color" string "Red" to RedFunction

    -> Map "color" string "Green" to GreenFunction

    -> Map "color" string "Blue" to BlueFunction

    How does it check which one we passed as a Parameter, Does it work Like "Else" or it just calls directly the one Selected one from the Parameter String? so basically its this method better and faster than do it in the old fashion way with Else, Else like I did on my previous Pictures

  • > what would be the benefit of having it be it's own block?

    I don´t see why such a map would need to be created during runtime with individual actions, rather than just beeing there.

    I think the best Idea is to support both ways if it's possible as some people would like to create at Run Time and some before RunTime I think, I can see the benefits through creating before RunTime if you have heavy Loops & Events Running at the start of layout and you prefer to avoid extra Events & Actions

  • What are you doing in those events? Sometimes you can eliminate the redundancy by using what you're passing as Enemy_type in an expression. For example you could look up a dictionary key, create an object by name, etc...

    Probably it wasn't a good example calling it only at the Start of Layout but Here is a better example to help illustrate what I was referring to, not sure if is the best example but I think you can get an idea, I tried to make it simple so it doesn't get messy with to much code, I just put a random example. so basically is just to illustrate that we call the Functions targetting directly the Enemy Type without checking every time "Elses" I hope it makes sense. but this is just one of many useful things that you can do by calling Functions by String.

    https://www.dropbox.com/s/ndkhuay0rgdsi79/New%20Functions.capx?dl=0

    ==================================================

    I think it should be possible to support this without using expressions for function names, though. The equivalent in a programming language would be a map or a switch-case of a string to a function call. Construct doesn't yet have any equivalent, but we could add one. It could work something like this. Suppose you have "Call function <string>" which can call one of "Red", "Green" or "Blue". That could be replicated with a "function map" feature along the lines of this:

    + On start of layout

    -> Create function map "color"

    -> Map "color" string "Red" to RedFunction

    -> Map "color" string "Green" to GreenFunction

    -> Map "color" string "Blue" to BlueFunction

    Note that RedFunction, GreenFunction and BlueFunction refer to built-in functions, and aren't strings (this would be some kind of new function-picker parameter). Then instead of "Call function <string>", you could use:

    -> Call function from "color" map with <string>

    That sounds like an awesome Idea looks like is exactly what we need

    Thank you for looking into it

  • It's impossible to get all the benefits of functions if you can call them by name, since it can't display the correct parameters and validate them. Instead, you can pass the dynamic part of the function name as a parameter instead.

    Thanks, I see what you mean

    I tried the way you advised but I still get the same Results I have to through all the "Else" Checking which is that what I'm trying to avoid when using Functions,

    Example:

    I tried By Passing the UID through a Parameter and then Pick the Object and check the Variable "Enemy_Type" directly from the Object

    Or by Passing the "Enemy_Type" Variable as a Parameter and check the results inside the Functions the same as the First Method.

    But Both are exactly the same thing they have to go through the process of all the "Else" checking which can be really Performance Impact when you have many Enemies and many Different Variables to check very often, ending up with long lists of "elses" is there any way to avoid this like we could do with the old Functions? or is any Plans to add it on the Future? as this feature is really important

    Thanks for your Time

  • One of the Most Powerful things that I liked about the Old Functions is that when you have to check a Condition that has many "Else" I could just then replace it by calling directly the Function to avoid many Else checks unnecessary especially when it has to check it very often, I tried to do the same with the New Functions but I couldn't, is this feature removed? will it be in the future? as it's very useful

    Thanks

    Here is what I mean:

    On here I have to check which type of Enemy is and depends on which enemy is he has to do different things, I haven't done any actions but you can get the idea

    When the Else becomes to many like on this Picture

    I just Replace it by this

  • Just saw what you said about pushing the value in the front of the array instead of inserting one. I also moved the events where the master array is setting its values to the other arrays as json into its own function called "compileArrays". It's getting me a little closer, but now when I load up the project, the scale is off and some of the objects are mismatched.

    Hard to know without seeing your whole Project see if this can help if you do everything the same as this example it should work if it doesn't work it must be somewhere on your project interfering with your Events

    https://www.dropbox.com/s/g8f4rni4bcul9sx/Save%20%26%20Load%20%20Custome%20Levels.capx?dl=0

    Apart from that, a few Tips that is nothing to do with your Last Problem is just to let you know:

    -When you set Array size (W = 0) you don't need to clear the Array Before as it becomes Empty anyway

    -When you try to Load an Array from Json you don't need to (Clear or Set Size) before that as it already loads the correct size from the JSON File

    -You can use Families also

  • I can open your capx as it uses 3 Plugins, but looking at your Picture of the Events this is what I see

    On your Function "On Save" you are downloading the JSON Array "edit_objectdata_AMASTER" before you save all your Info of the Objects of the Level, The Array "edit_objectdata_AMASTER" download AsJson it should be at the last Event after you save all the Info on it.

    Also on the same Function "On Save"

    Make sure you set the size of the Arrays to = 0 before you use the Expression Insert so you don't create extra Empty Cells on the Arrays

    Example:

    Before the Loop set Array Size

    W = 0

    H = 1

    D = 1

    Then use the Loops to save the data example to save the coins:

    -set Array Size

    W = 0

    H = 1

    D = 1

    -Then For Each Coin: Array Coins Push Front Coin.AsJSON

    Note: The Array Sizes you set them Once only and outside the Loops, probably at the Beginning of the Function on Event 78, set all your Array Sizes there

    Also, you don't need to clear the Arrays if you set the Size (W = 0)

    =--------------------------

    Now if you Did what I Wrote above you should have each Array as 1D = 1 Dimensional Array

    so you need to change the Events On Function "BuildLevel" Especificly the Loops that you use on the Array

    -Instead of using Array For Each XYZ you need to replace it by Array For Each X Element

  • If its a new Picking you need to start from scratch always Comparing Variables etc.... But if the Picking didn't change you could save the UID of the Sprite so you can keep Picking it whenever you need directly

    Example:

    Have a look at on "Key Down Pressed" I Pick directly the Player I need By UID without the Need to loop again throughout all the Players to check who is matching the condition as opposite than we do on the Function "Pick_Player"

    Also, you don't need that many Functions as Newt mentioned

    https://www.dropbox.com/s/3jjshxd3bjkq98q/Picking.capx?dl=0