Sami424's Recent Forum Activity

  • Could be due to certain fonts, cant you just make the text object smaller to fit your needs ? Just change height. I would say try centering with css styling properties but i think c3 does this with text objects .

  • You can use CSS styling to achieve this. You can for example change the look when the text is overflowing (going past the object size) But you can also just make it simple and for example count the letters and change the width of the text object based on how many letters are in the text object

  • Your in the right track. You will use for example room properties.

    Check out photon matchmaking Documentation doc.photonengine.com/realtime/current/lobby-and-matchmaking/matchmaking-and-lobby

    You could basically use unique room names, or set filters for the rooms.

    This may seem complicated at first because the documentation shows code but most photon c3 plugins have the features in event sheet, at least i know chadoris photon plugin has it.

  • > i am coming from c# and backends like php where i am used to strict types and not loose types like in js.

    You might like to try using TypeScript which gives you strict type checking.

    For some reason i never checked it out xD After some research on it i am now using it, its so nice i love the fact that i can use strict types in js and i was able to connect my vs code to construct 3 by following the guide and its just so great, thanks for the tip!

  • If you can share the model, I'll check it out.

    Hey i solved it by importing it to blender and exporting as gltf glb.

    Seems the models were bad since online verify tools also could not read them. Im a bit unsure how to place the models to be aligned correctly but i just rotate the model for now in construct

    Thanks!

  • Well yeah, like that you have direct access to the class without having to import, but I'd say it's kind of dirty to program it like that hehe. At least to me it makes sense to have it organized that way. Just as an example:

    > import * as Player from "./player.js";
    

    Now I have the Player Module, which can include more than just the player itself. It could also contain, say, the camera and the player weapon, which kind of make sense to be part of the player Module. Like so:

    > runtime.objects.player.setInstanceClass(Player.Player);
    runtime.objects.camera.setInstanceClass(Player.Camera);
    runtime.objects.sword.setInstanceClass(Player.Sword);
    

    So everything regarding the player will be inside one separate file. And the setInstanceClass can happen only in one file in one place. So if something goes wrong or I have to add another instance class, I know exactly where to look.

    I write plenty of dirty code btw. but I still try to keep it minimal and do regular cleanups. There's nothing wrong with dirty code to a degree. Be more like Balatro-dev and less like Yandere-dev. Both have "dirty" code but Balatro is printing infinite money and yandere simulator still isn't finished (it's been 11 years)

    Yeah now that you said it, i feel like your approach is better in the long run for sure. I to like organized code :p im just unfamiliar with how JS organized code looks like, since i am coming from c# and backends like php where i am used to strict types and not loose types like in js.

    Thanks !

  • Im not finding anything on this, is there a specific API for families in c3 scripting ?

  • New release of 3D Object with major changes. It now supports GLTF models with animation thanks to R0J0hound's code that parses gltf and does animation.

    I added some animation ACEs and ZElevation ACEs, expressions and control for ZScale ACEs.

    It does not yet render in Editor (as I did for obj files) but I will be working on that. It now renders in editor.

    You can try it here, it is still under development:

    https://kindeyegames.itch.io/c3-3dobject-alpha

    Also if Scirra is interested in integrating this into C3 directly, please feel free to contact me, I would be happy to share it (I know they may not because dealing with 3D models, formats, performance, etc. is a bit complicated in terms of user expectations for simple integration in C3 or they may be planning something else already.)

    Example with 3D object, 3D shape, 3D camera.

    Subscribe to Construct videos now

    Anyone else experienced "Array Length" error when importing GLTF files? I have a issue with a 3d model pack im using.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You need to export the class and

    > runtime.objects.plr.setInstanceClass(plr.plr);
    

    the first plr is the module, the second plr is the class.

    Hello, ok thank you.

    So basically, i noticed why it was working for me before.

    If i set instance class of a instance in main, you both are right i have to export the subclass and then use plr.plr

    However, i noticed, if i add the runOnStartUp in my subclass file, i dont have to export the class at all, and it works aswell.

    Look at the Player class here:

    class PlayerInstance extends globalThis.InstanceType.Player
    {
    
    constructor()
    {
    super();
    console.log("Created!");
    }
    
    }
    
    runOnStartup(async runtime =>
    {
    	// Code to run on the loading screen.
    	// Note layouts, objects etc. are not yet available.
    	
    	runtime.objects.Player.setInstanceClass(PlayerInstance);
    	runtime.addEventListener("beforeprojectstart", () => OnBeforeProjectStart(runtime));
    });
    
    async 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
    }
    
    

    Then i just import the class in main, without using export at all.

    HOWEVER, if i setInstanceClass in main, i will have to do PlayerInstance.PlayerInstance like you mentioned, and i have to export the subclass.

    Thanks for clearing this out guys, i was confused after a few hours of work yesterday.

    Have a great weekend!

  • In your subclass it doesn't show that you are exporting the class.

    Hey, yeah i tried that, usually dont have to export subclasses, i might be wrong tho.

    I tried adding export, sadly still same error 😭.

  • Alright thx, feature request it is. The workaround is ok, but I always set out to do a game and make it "javascript only" just to end up back in the event sheet for random reasons. Either be it workarounds, missing APIs (or intentionally left out) or simply convenience with some things. Not a bad thing per se but not exactly what I plan, haha.

    I feel you, however after awhile you will notice that some stuff is just easier to do in the event sheet, code is still js even if you use the event sheet, i usually say if someone has done it, why redo it 😉 that said i had the same issue with some stuff like pin etc, where i had to create it myself, but then i said screw it and just used the event sheet, works fine for simple things like on start of layout etc.

  • Ok so my subclasses was working great, now i am getting error:

    runtime.js:1 [C3 runtime] Error in runOnStartup function: TypeError: expected function at C3.RequireFunction (typeChecks.js:1:2563) at self.ISpriteObjectType.setInstanceClass (IObjectClass.js:1:1269) at main.js:9:22 at C3.Runtime._RunOnStartupFunction (runtime.js:1:12581) at C3.Runtime.Init (runtime.js:1:12030) at async Q._InitDOM (domSide.js:16:12442) at async Q._Init (domSide.js:16:7621)

    But this was working great before, i tried with a empty project, and the same happened?

    Here is main.js:

    import * as plr from "./plr.js";
    // Import any other script files here, e.g.:
    // import * as myModule from "./mymodule.js";
    
    runOnStartup(async runtime =>
    {
    	// Code to run on the loading screen.
    	// Note layouts, objects etc. are not yet available.
    	runtime.objects.plr.setInstanceClass(plr);
    	runtime.addEventListener("beforeprojectstart", () => OnBeforeProjectStart(runtime));
    });
    
    async 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
    }
    

    Here is my subclass:

    class plr extends globalThis.InstanceType.plr
    {
    
    constructor(){
    super();
    console.log("toatewg");
    }
    }

    I have now tried multiple fresh projects, i am unable to subclass, i have no idea why.

    [b

    ] P.S: Whoever thought "undo" should apply to all my script files in a project and not the CURRENT script file im working on, you and me we have a problem !

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