Spock's Forum Posts

  • The example scripts I posted previously are all intended to be used in "Actions" within C3 or C2Runtime not from your html. If the "iframe" or "Object" is in a different directory that's where the "window.parent" plays in. As well your Javascript should be called from a ".js" file rather than inline scripts.

    Also, I found that Construct games work better in an "embedded object" and not an "iFrame". However of course use whatever works best for your project. Just something to try.

     <object>
     <embed src="index.html" width="100%" height="100%"></embed>
     </object>
    
    
  • I agree, it is unfortunately a hack. As well, of course I am open to doing this properly. However I could not find the proper solution at the time.

    I used this hack to clear all saved data stored to the local machine from the "System Save Slot". It acted as a simple one line function to globally clear everything in the project itself. Unlike the browser clear cache, which isn't practical for this project.

    Unlike "localStorage" which has (Clear Storage, Remove Item) the "System Save" doesn't seem to have a clear function. It only has (load, load from Json, save) I am open to suggestions and appreciate any feedback you may have.

    Many Construct users have had this question and have also resulted to deleting the database.

  • Before I switched to C3 Runtime I was able to delete the Save State Database "_C2SaveStates" located in the c2runtime.js This simply clears all save states.

    	"window.indexedDB.deleteDatabase('_C2SaveStates');"
    

    however, I am unable to find the name of the indexed DB in "scripts/c3runtime.js". One would assume it would be "_C3SaveStates" but it is not the case.

    Anyone know what the database ID changed to?

  • 	ACTION > Browser > Execute JavaScript > "yourfunction();"
    

    If you are calling a JS string as a C3 value.

    	Browser.ExecJS("yourvar;")
    
    	Browser.ExecJS("yourvar='newvalue';")
    

    If it is in an iframe or object one directory deep use:

    	ACTION > Browser > Execute JavaScript > window.parent.yourfunction();
    
  • I know this is an old post, but since C3 Runtime is now the default and not C2 I think this still applies.

    When I switched to C3 a lot of my project broke, so I am trying to get things working under C3 Runtiume.

    For some time now I have been successfully deleting the database by:

    	window.indexeddb.deletedatabase('_c2savestates');
    

    However, I can no longer find the name of the database in the scripts/c3runtime.js so I am unable to delete it like I have in the past.

    (Started a new topic here: https://www.construct.net/en/forum/construct-3/how-do-i-8/how-to-delete-indexeddb-in-c3-138497)

  • Turns out it is an Edge bug and the ticket is now closed.

    I did find some working examples in Edge using Javascript to capture the Canvas Element in Edge. However I am struggling to get this to work with Construct 3's Canvas Element. Main issue is I cant seem to reference the Construct 3 Canvas properly.

    var canvas = document.querySelector( 'canvas' ), c = canvas.getContext( '2d' ),

    Please see working Edge examples below:

    Working example in Edge with download prompt: eligrey.com/demos/FileSaver.js

    Another example with plain JS but requires right click save: jsfiddle.net/codepo8/V6ufG/2

    So, this is still possible just not with the Invoke Download from within Construct 3. Need to use 3rd party JavaScript.

  • Thanks,

    I added a ticket for the bug: github.com/Scirra/Construct-3-bugs/issues/2016

  • Not sure where the Construct (3) Bug Reports should be sent to? I only see Construct (2) Bug Forum.

    Attached Project File C3p: 1drv.ms/u/s!AnjqkTqN7TavhOY61wBt05G0Zu4yYg

    File only contains, 2 buttons 1 sprite and the actions in the screenshot above.

  • I created a new blank project. Simply added both Invoke Downloads. These work correctly in Chrome/FireFox but fail to open in Microsfot Edge.

    EDGE ONLY:

    1. Screenshot PNG

    - Result: HTML1300: Navigation occurred. PNG data in console

    - Fails to download

    2. Download Json

    - Page reloads

    - Fails to download

    C3 Events/Actions: s22.postimg.cc/agghi4tcx/C3_Save.jpg

    Looks like Download from Construct 3 is NOT supported in edge. If that is the case I will have to completely redirect users to use chrome/firefox and block IE/Edge completely. My app requires download/screenshot.

  • Hello,

    Having issues with Microsoft Edge. File Download Menu Will Not Open but Upload will.

    Invoke Download (CanvasSnapshot) as well AJAX FileChooser (FileChooser.FileURLAt(0)) will not open the File Menu.

    The only thing I get in console is: HTML1300: Navigation occurred then the packet for the item being downloaded. PNG data and JSON data (I have 2 download functions that trigger independantly, not at the same time.)

    HTML1300 "Navigation occurred" A new page was navigated to, or the current page was refreshed. This is an informational message and not an error.

    It looks like the file attempted to download. I can see the json data and png data. But the menu never opens.

    However, my "Upload File" is working and opening...

    Anyone have an idea why? Chrome, FF all work correctly.

  • For Example, I created a sprite when the PathFinding starts. "-1" is where the Arrow started. However, no line was created and "0" is where it starts.

    It Should start at -1 not 0

    Screenshot: s22.postimg.cc/ybgipix41/line.jpg

  • This is perfect, thank you. I was about to upload a modified version of the Path Finder tutorial that I was working on. But your example works much better than what I created.

    Thank you!

    PS. One thing I noticed, sometimes the Start Node is not the same as its last current location. Meaning, when you click, it will start the node in a different location rather than where the current "Green" arrow is positioned.

  • Hello,

    I am trying to figure out how to draw a line with Path finding. Currently I draw a line that snaps on a grid, however I need to automatically avoid chosen obstacles. (RED BLOCK is an obstacle.)

    Example:

    https://s22.postimg.cc/5u2v08ve9/path.jpg

  • Solved:

    1. Create an empty <div> that spans and covers the entire game.

    2. Via CSS set

    html, body, canvas {

    touch-action: auto;

    }

    If you are also using "touch-action-delay: none;" comment it out.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Hello,

    "Can't scroll page after interacting with canvas on touch screen"

    My game lives in a <div> that on load fills the screen and I have other content that lives below the fold

    Issue is on mobile the user is unable to scroll down to the rest of the page. The touch events in canvas override the swipe down on mobile. However on desktop this works since a scroll wheel is used and not touch.

    My only idea so far is to just call a function from Construct attached to a swipe up/down action and then with javascript use ScrollTo and fake the page scroll. But I rather find a cleaner solution.