Sami424's Recent Forum Activity

  • Why dont you want to just import the files in c3 by right clicking the sounds folder ? Just curious

  • You want to upload a file from the code ? Am i correct ?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • If i am correct, your trying to make it like a candy crush feature almost, that if 3 same color blocks are on eachother they will get removed ?

  • The code in your initial post appears to be correct. Maybe you didn't set the right script purpose properties. The easiest way to get help is to share a project file, so others can see exactly what you've done - otherwise all we can do is guess.

    Basically the code above is all i did to test the import/export. I solved it as the problem was on my end, i forgot to export the class properly. Thanks for your reply

  • See the guide in the manual on using an external editor.

    Thanks for your answer, i read it and i kind off did that but my intellisense etc is not catching up the c3 classes etc. I might done something wrong, i will try again. Thanks

  • You can use APIs online, such as firebase etc.

    Or make your own using php and storing data to database and use Ajax calls to save to it from c3

  • I have been looking around, i found a very old plugin for VS code that doesnt seem to work. Any way for me to work in vs code for my construct 3 scripts? I work with VS Code so this would make stuff much easier.

  • Alright so i solved it by doing

    // I import the class named myClass from my js file, the class has an export tag. 
    import { myClass } from "./myclass.js" ;
    
    // I instantiate the class
    let customClass = new myClass();
    // I can now use the functions declared inside myClass
    customClass.runMyFunction();
    
    

    This is working, i dont know if i am doing it correct, but this way its working. I am getting more familiar with the import/export in construct.

  • hello everyone !

    how u doing ?

    Is it possible to hide or show a layer from a specific layout or from the current layout?

    You can get specific layers easily from a layout:

    // get a layer from the current layout
    let myLayer = runtime.layout.getLayer(1) // 1 is the index of my layer, you can also just put the name of the layer as parameter.
    

    after getting the layer you can set visibility:

    myLayer.isVisible = false;// Will hide the layer

    You can also use the

    runtime.getLayout("myLayout");
    

    to get a specific layout.

  • I've been trying to create a system for reading and writing variables through expressions (i.e. a function to evaluate an expression like "Var1 == 0 & Var2 = 1" and similar functions to change/add/subtract variables). For a while, I've been assuming the best way to do this is to declare the variables in the Event Sheet as normal, then interact with them through code but it occurred to me after another readthrough of the (brilliant) scripting documentation that I could just declare the variables in script (let Var1 = 1, etc.) and avoid the awkwardness of Event Sheet/Javascript cross-communication altogether.

    I'm still not completely confident with Javascript and would still keep the majority of the project in visual code. With that in mind, are there any particular pitfalls or dangers to handling most of my variables in javascript?

    As Ashley mentioned it depends on what your doing, i actually like working with the variables in the event sheet.

    Declaring a variable like

    Let myVar = 5; 

    is just declaring the property in JavaScript .

    Is not the same as declaring s global,local or instance variable ( i think )

  • Hi Ashley

    Thank you for your reply.

    Ok for arguments sake I have created a new project and on the event sheet I've added one script as follows

    System > On start of layout >

    let audio = new Audio("https://streaming.galaxywebsolutions.com/stream/moorland");

    audio.play();

    When you run the project it starts and plays the audio from the script.

    However as it is ran direct from the script I can not tick the play in background on the audio object as the audio object as not been added to the project, therefore all works perfectly apart from the background issue when the app sleeps or loses focus.

    I can not call (or at least I don't know how to call) the stream from the audio object as it is continuous and a live mpeg stream which can not be changed to a different format.

    How would I get my project to steam this URL via the audio object so that I can then check the play in background box, so that the stream continues to play in background mode on both Android & iPhone?

    Many thanks

    Adrian

    I dont think you can make it play in the background on mobile phones using the default audio object. The option is for browsers that support it.

    I might be wrong tho.

  • Edit: so importing and exporting functions is working for me.

    How do i import a class for example a sub class that i made ? Do i have to instantiate the class before using it like

    Let myClass = new myClass():
Sami424's avatar

Sami424

Member since 9 Jul, 2018

Twitter
Sami424 has 6 followers

Trophy Case

  • 6-Year Club
  • Entrepreneur Sold something in the asset store
  • Forum Contributor Made 100 posts in the forums
  • Regular Visitor Visited Construct.net 7 days in a row
  • RTFM Read the fabulous manual
  • Email Verified

Progress

11/44
How to earn trophies