locohost's Forum Posts

  • In preview mode NWjs.AppFolder is blank. I'll try exporting to see if it then has any path string.

    Ok... so the manual, that I did read fairly thoroughly, has an error and is missing a sentence in the "Previewing" section. NWjs.AppFolder does not contain the install folder in "preview" mode. It is blank. You must export your game as NWjs for AppFolder to contain the path to the install folder.

    So this evening I'll try hard-coding a full path like "C:\somePath\someFolder\pawn-icon.png" in the Sprite.LoadFromUrl method and see what happens. According to the manual, this will load the image from disk.

    EDIT: Actually the manual quote above about hardcoding a path is referring to the NWjs methods like Read and Write, not the Sprite.LoadFromUrl. So my test above will fail. So the answer to my OP is you must be running an NWjs exported project to load a Sprite image (that is not known prior to runtime and imported into C2) from disk. That's the only way you can do this.

  • The problem remaining is you MUST "import" the file in C2 editor. You cannot tell a Player to drop files in this folder and expect them to load when the game runs :-/

    Sadly a running C2 game has no way to reference a local file during runtime that wasn't imported during design/build time.

  • Project Files

    Yep that worked. Import it into "Files" then the path to the image is simply "pawn-icon.png"

    LittleStain Thank you!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Ok, so these on the right events are within a function..

    So http://localhost:50000/textures/pawn-icon.png does exist?

    Or Would you need a different directory?

    Seems like this is a preview and you are trying to reference a directory inside an exported project, or are these project-files we are talking about?

    Right now I'm just running in preview mode.

    "Textures" is a folder in the Project root. Where should I put an image file that I want to load in code?

  • What is the function Global_Log and what is Function.param(3)?

    I added what F(3) param is above in OP. Global_Log writes to Console.Log. It shows "Textures\pawn-icon.png". It's correct.

  • NWjs isn't creating a correct path to the file so it can never load. Function.Param(3) = "Textures/pawn-icon.png".

    Open image in a new tab to see un-forums-cropped version...

    I've tried using NWjs.DroppedFile too. Same result. NWjs properties do not have paths to files.

    What am I doing wrong?

  • Too much mousing required to create an Action and move it to correct location within Event.

    How excellent would it be if after you create an Action and hit Enter, the Action is highlighted, then you can use Alt-Up/DownArrow to slide it up/down into the correct position? All new code editors have this "Move code line with Arrow" functionality. Can we?

  • I can't test this at the moment, but can't you get around the "next top level event" limitation by using the "pick by UID" condition. If I remember correctly, you should be able to create the sprite (or whatever) instance, and then pick the family instance by the UID of the sprite instance.

    Yes I think you're right. This is what I'm doing. Pick by UID is the only pick that works immediately, in same event.. That I can see.

  • It's actually pickable at the next toplevel event too.

    Yep, I'm doing this. It works fine. However, I'll always be on the lookout for any way to write less lines of code

  • I had this problem about a year ago and got so frustrated with it that I gave up.

    If you are setting the sprite position with every tick, it MAY have to do with the event placement in the event sheet. I found I had better luck when I placed the every tick event at the top of the event sheet. Even so, I never got a sprite to follow the cursor one to one.

    No I'm not using any "Every tick" events. Just the out-of-the-box drag/drop behavior on a sprite.

  • You have absolutely no events that run every tick, or just no events where you use the condition system every tick?

    Not that that would normally interfere, unless one of them has actions attached that conflict with the dragging..

    Does the sprite you are dragging have any (other) movement behaviours attached, or are there events with actions setting it's position that could be conflicting/interfering?

    Using multiple event-sheets and/or many events shouldn't have effect..

    I guess the only reason the VM would have any effect is if it's somehow reducing framerate, or hasn't got enough memory/cpu/gpu assigned..

    Did you check your framerate and (image) memory usage and cpu usage (using the debugger)?

    No event using "Every tick" event.

    It's a local Hyper-V so I can bump the specs waaaaay up and try again this eve. If that doesn't work I'll temporarily install C2 in the host OS and see what happens.

  • You have absolutely no events that run every tick, or just no events where you use the condition system every tick?

    Not that that would normally interfere, unless one of them has actions attached that conflict with the dragging..

    Does the sprite you are dragging have any (other) movement behaviours attached, or are there events with actions setting it's position that could be conflicting/interfering?

    Using multiple event-sheets and/or many events shouldn't have effect..

    I guess the only reason the VM would have any effect is if it's somehow reducing framerate, or hasn't got enough memory/cpu/gpu assigned..

    Did you check your framerate and (image) memory usage and cpu usage (using the debugger)?

    No event using "Every tick" event.

    It's a local Hyper-V so I can bump up the specs waaaaay up and try again this eve.

  • >

    > > Pinning should do the trick..

    > > Could it be you are pinning every tick instead of once?

    > >

    > > Without seeing your events/capx the question is hard to answer..

    > >

    >

    > Even dragging just 1 sprite around on the screen (nothing pinned) lags behind the mouse cursor. Even in the NW.js export. A little better in the export, but still noticeable. I have a modern laptop (i7 4810, 16GB RAM) too so I think it's just an inherent performance issue with JavaScript games. I don't think there is a solution other than using another tool and building a native app.

    >

    > I'm doing what I can to minimize the visual performance things. I think it will be Ok.

    >

    > Question: Is there any way to completely turn off Physics in the whole game? I don't need any.

    >

    If you haven't added the physics behaviour, it isn't present..

    I have not so I guess I'm Ok there.

    [quote:1bh7eyw9]

    I've never really noticed a lag while dragging anything other than DOM elements..

    Could it be something else is interfering with the behaviour?

    Does the number of events or type of events affect this? I have no "every tick" events. I do use a lot (well several, like 10ish) of event sheets, 1 sheet for each main game object to keep related code together. Would this have an effect on performance?

    One last possibility: I'm working on a Win 10 VM. Maybe the VM is causing the lag?

  • Pinning should do the trick..

    Could it be you are pinning every tick instead of once?

    Without seeing your events/capx the question is hard to answer..

    Even dragging just 1 sprite around on the screen (nothing pinned) lags behind the mouse cursor. Even in the NW.js export. A little better in the export, but still noticeable. I have a modern laptop (i7 4810, 16GB RAM) too so I think it's just an inherent performance issue with JavaScript games. I don't think there is a solution other than using another tool and building a native app.

    I'm doing what I can to minimize the visual performance things. I think it will be Ok.

    Question: Is there any way to completely turn off Physics in the whole game? I don't need any.

  • Pin does the trick, but other objects lag behind like a trail of ducklings. Nothing can be done to fix.