ddabrahim's Forum Posts

  • I come to the decision I would like to use the license from the Scirra Store, but I'm wondering if that's even possible or not.

    I mean it is not a "public license", it might be the property of Scirra and I'm not allowed to use it like copy and paste the text am I?

  • Hi all!

    I'm thinking about selling source files, not only Construct 2 project files but also others and I have a difficult time to pick a license and I would like to ask for some opinion and suggestion.

    What I would like to do is allow to use the source for any purposes but do not allow it to be shared, redistributed with or without any modifications.

    I was looking through source code licenses but to be honest in most cases (maybe also because my english is not very good) I'm not certain what the license allow or don't allow exactly.

    For example I was looking at Creative Commons Attribution-No Derivatives 4.0 International license:

    creativecommons.org/licenses/by-nd/4.0

    But what I don't like about the license is that the short human-readable version suggests:

    [quote:19yok5y3]you can share and redistribute the material as long you give appropriate credit and don't share or redistribute the material with any modification.

    But this is exactly what I don't want to allow. I know the long and dry legal version may don't allow to share or redistribute the material in any way and form but I want a license that is get to the point and easy to understand for everyone.

    As an alternative I was considering to copy the Games with Source license from the Scirra Store and use that.

    It is sounds exactly what I want but I'm not sure if including this text as-is in a text file would be enough.

    I would appreciate any suggestion and opinion on this.

    Thanks.

  • [quote:3e737lpy]there's an event in the Audio plugin to pre-load

    Yes I tried that but it doesn't work. I even tried to preload the audio in the first layout and go to the next after all the audio is preloaded but still having the problem. The only thing helps (for some reason) if I play the sound once on start of layout.

    But I have this problem only in Firefox and only if I play sound at object. If I just "play sound" that works.

    It must be something with Firefox and the "play sound at object" action.

  • [quote:1v5vwtnc] try playing the sound once (muted) on start of layout

    Thanks a lot, it worked

  • Hi.

    I'm having a little problem with playing audio in Firefox.

    What I'm trying to do is simply play an explosion sound on collision. But the problem is, when collision is happening for the very first time, the explosion sound is played about two seconds after the collision but only for the first time. After the first time the sound is playing fine but never the first time. It is not a big deal but I just don't really like it and I would like to fix it if possible.

    I was searching the forum and I tried all the suggestions I found:

    -tried exporting the project but didn't solved the problem, I get the same result

    -the sounds are preloaded in the first layout and I go to the next layout after all the sounds are preloaded

    -the sounds are stored in the sound directory

    -deleted the duplicated sound files created by the importer and left only a single sound file (.ogg)

    -my browser is up to date

    Nothing worked. The only thing I haven't tried yet is to upload the exported HTML5 game to a host such as itch.io...

    If I preview in Google Chrome, it works, no problem there, the sound is playing as it should. I have this problem only in Firefox.

    Is there anything else I can try to fix this or it is down to Firefox (and Construct 2) to provide better support and compatibility?

    Thanks.

  • Thanks a lot it worked

    The "On created" event and the floor() expression sort of worked but for some reason the floor(random()) expression always returned only 2 of 3 possible values like it was returning only 0 and 1 or only 1 and 2 but never 0,1 and 2... but the choose() expression just solved all the problems

  • It seems like my original question has been deleted:

    It doesn't exist.

    I have explained what is my problem is and what actions I tried to solve the problem on my own.

    Anyone able to explain it to me why is my topic has been deleted?

    Fortunately I always copy the text before submit so here we go again, if there is any problem with it, please explain.

    I was searching the forum but can not find the answer.

    I'm creating 10 instances of the same object at the start of the layout and what I'm trying to do is set their animation to be a random animation for each instance but I can't get it to work.

    I have 3 animations and I named them 0,1 and 2 to be able to set the animation randomly using the random() expression.

    Basically, this is what it looks like:

    On start of layout:
    sub->Repeat 10 times : Create object
                          : Set animation to str(random(2))[/code:8jiwq5dk]
    
    But it doesn't work. Each instance display the first animation like nothing happened.
    I have even tried using an instance variable. First generate a random value, store it inside an instance variable and use the variable to change the animation but I get the same result. I have also tried using the For each condition after all the objects are created:
    
    [code:8jiwq5dk]On start of layout:
    sub->Repeat 10 times : Create object
                          : Set animation to random(2)    //this is an instance variable of object
    sub->For each object  : Set animation to str(object.animation)  [/code:8jiwq5dk]
    
    It didn't work either. 
    The only thing I managed to get to work is a counter variable.  I increasing the value of the variable after each instance created and use that to set the animation.
    
    [code:8jiwq5dk]On start of layout:
    sub-> Local number counter = 0
    sub->Repeat 10 times : Create object
                          : Set animation to str(counter)
                          : Add 1 to counter
    sub->-> counter = 3   : Set counter to 0[/code:8jiwq5dk]
    
    This is the only thing that works and set the animation of each instance to be different but it is not exactly what I want. 
    
    Anyone could help me please how to set random animation for each instance?
    
    Thanks.
  • Thank you for your reply. I thought writing local files might be not an option, actually I'm just experimenting with Local Storage and it seems to be fine but data integrity is very important I don't know how reliable it is. I haven't actually thought about setting up a database on a website, I'm might give it some thought.

    Thanks.

  • Finally I managed to get the Dictionary work. Technically, it is require only 3 simple steps:

    1. To Save Dictionary in to LocalStorage just Set Item as JSON string using the "Dictionary.AsJSON" expression.

    2. To Load Dictionary, first Get Item from LocalStorage using the key previously used to save Dictionary

    3. Finally, check if you get the Item then Load Dictionary from JSON as string using the "LocalStorage.ItemValue" expression

    That's it. After, I can simply go through each item in the dictionary one by one as I wanted and add them to list, check their number, value, text..etc Awesome

    Thanks for all the help.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I think I don't understand

    This is what the documentation saying:

    [quote:1hlow1d6]AsJSON

    Return the contents of the Dictionary object in JSON format. This can be later loaded back with the Load action

    The load action in the dictionary object require a JSON file but the local storage can not save or load JSON but individual items

    I'm confused, is there any example or tutorial how to save and load a Dictionary object with all items?

  • Thanks a lot, it worked

    I don't really understand how to save and load a Dictionary object

    The documentation mentioning something about the asJSON expression and AJAX to save and load the content as JSON.

    Should I use the "post to URL" and "request URL" to save/load the dictionary as JSON (using the Dictionary.asJSON expression at "Data") then use the Load action to load the info from JSON file in to the Dictionary?

    Thanks.

  • Hi all!

    What I'm trying to do is, save values using the local storage under key names set by the player, means I don't know exactly what the key names are going to be and on start of the layout I want to load all keys from storage and add each key to a list object.

    There is an action to "load all keys" but I can't find a "for each key" or similar to be able to go through each and every key individually and add them to the list object one by one.

    Anyone could point me in to the right direction please?

    Thanks.

  • Hi all.

    I would like to manage a database that can be modified and created by the users in-game and I would like to do it through (create/write/store) local files instead of web storage. I was searching the web and the forum to find the answer if Construct 2 can write and store local files but I can't find a straight answer. Many people only asking about how to read external files but what I want to do is not only read existing files but also write and create local files on mobile devices and I'm wondering if Construct 2 can do that or not?

    So far it seems like I can generate JSON files and download it, but it is not exactly what I want because I want to store the files within the application and not to download them. NW.js object seems to be able to read and write files locally, but it is desktop only as far as I know but I need the functionality on mobile (or is it works on mobile too?).

    Anyone could tell me please if it possible to create, write and store local files in a Construct 2 application on mobile devices?

    Thanks in advance.

  • 3rd party level editors such as Tiled are not supported out of the box but maybe you can try to write an importer, I have never tried.

    AGK got a very basic level editor hidden inside the installation folder, it is so basic it not even mentioned and don't even worth mention it really. For most part, you need to use code to build your levels or you can make your own level editor that works the way you want.

  • The editor to code in Basic is based on Geany and it is running totally natively.

    As of C++, I'm not 100% sure, I have never tried C++ with AGK, I'm happy with coding in Basic. To use AGK with C++ on Mac it is require Xcode, on Windows it is require Visual Studio, I don't know if anyone had any success with C++ on Linux or with anything different than Xcode or VS.