Hayeck904's Recent Forum Activity

  • My project stopped working after the latest update. After some digging I discovered it's because webworker mode is enabled by default. With webworker on I can no longer access the document object in javascript. I used the document object to add third party .js to the page on startup for use by the rest of the project. My current workaround is to turn worker mode off.

    Does anyone have any ideas how I could achieve this with worker mode on?

    Is there a way to run one script on the main thread and the rest on a worker?

    Is there a whole different way to do what I'm trying to do?

    Any tips are appreciated.

    Example Code: (Only works if ran on the main thread and not a worker)

    	function exampleFunction(){
    	var script1 = document.createElement('script');
    	script1.src = "https://www.3rdparty.com/api/1.0.0/code.js";
    	document.getElementsByTagName('body')[0].appendChild(script1);
    	script1.onload = function(){exampleFunction2()};
    }
    

    Tagged:

  • Hey just wanted to say thanks for posting this.

  • I figured it out!

    I needed to blend the "darkness" texture instead of trying to blend the shadow caster object.

    I'm going to update the original post and give a link to the project in case anyone wants to create a similar effect.

  • I believe iFrames are html elements that sit on top of the canvas just like the text input object. There's no way to place them under any elements drawn on the canvas.

  • Hope this helps!

  • Its very hard to understand your question but I use firebase with construct 3 so I'll try to help.

    I think you're asking how to update a field in a firestore document? You're probably trying to set one field of a document and finding the whole document is gone except for the one field. Make sure you use the "update" function and not the "set" function. The documentation is here: https://firebase.google.com/docs/firestore/manage-data/add-data#update_fields_in_nested_objects

    Example:

    db.collection("users").doc("b").update({
     health : 0
    });
    
  • Update: I figured it out.

    I made the information a tutorial.

    https://www.construct.net/en/tutorials/create-lighting-effect-game-2335

  • Alternative Question:

    Does anyone know of a way to change opacity of individual tiles within a tilemap object?

  • Just grabbed a random picture off of google as an example of a tile-based lighting system.

    In this picture its clear that the lighting is calculated per tile.

  • Thread Purpose: discuss tile based lighting systems in construct 2/3.

    My game has a fixed 64x64 tile system using the tilemap object.

    I created an array that holds a light value for each tile (example: index 10 on the array represents the light value for tile 10 on the tilemap).

    I created a system to update the light array based on certain events (spawning a new light source, building a wall, ect).

    Now this is the hard part. What is a good way to represent this data to the user?

    A silly solution would be a bunch of 64x64 black squares that individually change opacity based on the lighting array.

    I'm hoping someone out there knows some layer blending magic that can solve this problem elegantly.

    Bonus Points:

    I'm using a shadow caster tilemap to simulate line of sight for the player.

    It would be nice if the suggested solution was flexible enough to take over this function as well.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You do not have permission to view this post

  • You do not have permission to view this post

Hayeck904's avatar

Hayeck904

Member since 4 Dec, 2014

None one is following Hayeck904 yet!

Trophy Case

  • 9-Year Club
  • x2
    Coach One of your tutorials has over 1,000 readers
  • RTFM Read the fabulous manual
  • Email Verified

Progress

12/44
How to earn trophies