Sami424's Forum Posts

  • In my game, there is a bar that will be active every 3 minutes so that we can gain power when we click on it and as you can see in the image, is there a chance that I can do this cleaner and with less code?

    and I add extra timer images for each powers, can there be a shortcut for this?

    You can use 1 timer behaviour for different timers using timer tags

    construct.net/en/make-games/manuals/construct-3/behavior-reference/timer

  • CSS means using HTML object instead of Text, which is not a good choice in many games.

    fanusgames Here is a demo:

    https://www.dropbox.com/scl/fi/qne4sezq4tnml8vb2pbrw/TextAutoSize.c3p?rlkey=1740darvr86bq71io58rnv7z8&st=55fffmkv&dl=0

    Make sure the height of the text box is big enough to fit two lines of text at max size, otherwise TextHeight expression won't work.

    Why is it not a good idea ? Im using js and html objects for things like drop down menus etc, ofc might impact performance if there is alot of html elements but i havent noticed yet.

  • Love the movement and style, good job!

  • Great job! I love how the ground gets destroyed just like in worms

  • 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 !

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • 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.

  • 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.