Mikal's Forum Posts

  • Are you talking about this plugin I did?

    construct.net/en/make-games/addons/224/funkyquad

    Can you share your project?

    What do you mean when you say 'is not in the preview'?

  • mostafanastary

    With the current set up here is a suggested way to do that:

    Create a layout 'Prefab' with no event sheet.

    For each different character, create a Spine object.

    Place one instance of each character on 'Prefab' layout.

    For each instance on the 'Prefab' layout, assign the atlas, json, skeleton name, etc.

    Now, on your main game layout and event sheet, you should be able to create the above objects with the default Spine settings for each object. You could also create a 'family' for the Spine objects, so you can have some common events, behavior for them.

    This all being said, Tower Defense games usually have a lot of objects, I would also do some quick performance testing to make sure that your expected number of Spine objects will run at the FPS you want for your game.

    Good luck!

  • Ah! It's because of a typo I think, I just got this to work in a project. Check your capitalization (for 'Web3'.)

    Script.js:

    // Put any global functions etc. here
    
    runOnStartup(async runtime =>
    {
    	// Code to run on the loading screen.
    	// Note layouts, objects etc. are not yet available.
    	await runtime.assets.loadScripts("web3.min.js","a.js");
    
    	
    	runtime.addEventListener("beforeprojectstart", () => OnBeforeProjectStart(runtime));
    });
    
    function OnBeforeProjectStart(runtime)
    {
    	// Code to run just before 'On start of layout' on
    	// the first layout. Loading has finished and initial
    	// instances are created and available to use here.
    	
    	runtime.addEventListener("tick", () => Tick(runtime));
    }
    
    function Tick(runtime)
    {
    	// Code to run every tick
    }
    

    Under project files, I have web3.min.js and a.js

    a.js:

    console.log("a script")
    var web3 = new Web3(new Web3.providers.HttpProvider("http://localhost:7545"));
    console.log(web3)
    
  • Right now that's not possible. For now, create a different object for each Spine character and set the specific json and atlas for each object/character. Post a request on the plugin github for this feature and it may get implemented.

    In your code, it will just create a SpineCharacter with properties that are defined for the object (you may need to create a dummy layout sheet with an instance of the Spine object to set the default values - if you are not placing it on the game layout in the editor.)

  • Ashley made some good comments about using await.

    If you need another possibility you could put your code that calls web3 into another script and have it load after the web3.min.js.

    For example, if you create a script called web3Example.js with

    web3Example.js:

    web3 = new web3(new web3.providers.HttpProvider("http://localhost:7545"));
    

    Then your other script would look like:

    runOnStartup(async runtime =>
    
    {
    
    await runtime.assets.loadScripts("web3.min.js", "web3Example.js:");
    
    // This code runs on startup with
    
    // the 'runtime' variable available
    
    });
    
    
  • [It looks like the post I was replying to was deleted, so I hope you already solved the issue]

    I am not exactly sure why you are seeing that error, but I remember a discussion about the order of loading and execution of the script files may be a bit difficult to control.

    construct.net/en/make-games/manuals/construct-3/scripting/using-scripting/script-files

    One simple way around this is to put all your scripts in one big file, but I think one of your files is big and minified.

    So another way to do this is to load the script files in the order you want by putting the files in the Project Files folder and then in the Project Scripts folder use the default script and load them in the order you want:

    runOnStartup(async runtime =>

    {

    runtime.assets.loadScripts("script1.js", "script2.js", "script3.js")

    // This code runs on startup with

    // the 'runtime' variable available

    });

    See: construct.net/en/make-games/manuals/construct-3/scripting/scripting-reference/interfaces/iassetmanager

    Interesting project, I also thought about doing something similar with a custom token, I was going to do the token issuing on a Playfab server to have a little more control (e.g. player registration, limits on tokens created, a little authentication, etc.)

  • Likely due to 'worker' mode.

    Project->Properties->Advanced, uncheck 'Use Worker'.

    I am curious, how are you going to use ethereum in your C3 project?

    In the future, you can press F12 (on Windows) to see the console during the preview and there you would have seen that the error was that 'window' was defined, which is an indication that the JS is not compatible to run in a worker (window is not defined in the worker space.) The C3 manual and some of the C3 blogs have details on worker mode.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Ah! I remember this! Thanks for doing a new version - it's a great family tradition! Now to go ruin my eyes staring at the screen for way too long, I better turn on NightShift. Well done!

  • Another example of using this nice template. I changed the template over to using JSON with keys as the source, with defaults that will change if the keys are present (the JSON is translated to the template's array on the fly for each line.) Using JSON with keys as a source makes it more readable for me, easier to directly edit the source file.

    Example of the JSON files:

  • Another better solution suggested by Buko-Studios:

    Add a transparent png which covers the required animation space in Spine, this works well with the C3 Spine plugin.

    For example, I added a semi-transparent object as an example so you can see how it works, you can change it so the object is completely transparent (using a fully transparent png.)

    Example:

    sTARKi

  • sTARKi

    I played with your animation in Spine, I have two suggestions:

    - Center your animation around the Spine origin

    - Create small, barely visible objects in Spine to create a bounding box.

    Below is an example using very visible objects (other fish) in Spine. Having them there will create larger bounds for the animation to play out in C3. In your final replace the other fish w/ small objects with a transparent image.

    Spine:

    C3:

  • Example project with atlas, json, png here:

    github.com/gritsenko/c3_spine_plugin

  • Also Playfab

    playfab.com

    There is a paid collection which includes playfab plugins (it does a _lot_ more than just cloud save.)

    constructcollection.com

    I am just a happy user.

  • Another note, now you can call alert() in worker mode in the new C3 beta release!

    construct.net/en/make-games/releases/beta/r194

    See the scripting section of the above post for how to do it (and thanks to Ashley for adding this support!)

  • This is likely because in your project 'worker' mode is enabled and alert() is not supported by a worker.

    Go to your project settings -> Advanced and deselect Use worker.