danterf4's Forum Posts

  • 5 posts
  • I would recommend taking the Learn JavaScript in Construct tutorial series which covers many of these questions.

    Thanks, I will do it

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • This is a bit off topic..

    I see you are creating a random deck of cards. This can easily be done by the Advanced Random and Permutation table functionality, without any JS. Just fyi

    That sounds great, could you share a tutorial or the documentation on how to use that?

  • If you place a variable defined in a JS script in the global scope it will be available in all other scripts.

    You can do that by writing something like this.

    > 	let myLocalVariable = 100;
    	
    	// This places the local variable above, into the global scope
    	globalThis.myGlobalVariable = myLocalVariable;
    

    You can try it out very quickly by running a script similar to that one on start of layout, then try adding a different script that runs, let's say, on a mouse click and check if the variable exists in globalThis.

    THANKS!! This helped me a lot.

    But now I have another issue.

    I want to access one of these global variables on an action, but I don't know how to.

    I thought about using globalThis.globalDealtCard or globalDealtCard but none seems to work.

    I'm sorry if I'm asking things already explained on the documentation, but this all seems really confusing to me still

  • Thanks everyone. I hadn't think about placing the script on the "on layout start" block, but it makes perfect sense.

    I was wondering, is there a way to create a global variable using JS?

  • Hi everyone!

    I'm having some issues creating an array using JavaScript and modifying it with a function. For some reason the array keeps getting initialized again and again. I believe it is because JS code works as a tick, and gets called every frame, so all that JS code is being called every frame. But if so, then how should I do this?

    I'm loving Construct, mainly because of the portability and the ability to develop on the go with my phone. But I truly believe there is not enough information out there about Construct 3.

    I'm trying to create a simple blackjack game to start dipping my toes on this. And the amount of times I hit a wall due to lack of information has been impressive.

    Like... I get using JS is hard, and I{m not the best at it, but come on.

    Let me know if any of you know more about good learning resources.

  • 5 posts