Hayeck904's Forum Posts

  • 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
    });
    
  • Try Construct 3

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

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

  • You do not have permission to view this post

  • You do not have permission to view this post

  • Didn't download your capx but I've encountered a similar problem so i'll try to help.

    Line 1 : remove npc destroy action

    Line 2 : no change

    Line 3 : duplicated line 2, change instance to 1

    Source: https://www.scirra.com/manual/124/system-conditions

    Section Pick Nth instance

    Now what if the running npc collides with 2 npcs at the same time on the same tick and you have to destroy all three.

    Idk? Is that possible idk? Is there a system expression showing how many instances of a trigger are created per tick, idk?

  • Use the "is pinned" condition from the pinned object.

    Then on your ontouch event add the condition bullet is pinned (and invert it so it basically says bullet isn't pinned)

    Now its possible I miss understood you when you said it continues to rotate a little bit once it hits.

    If by that you mean you had your bullet rotate a set amount of degrees per tick towards touch.x and touch.y

    then you'll have to add an event on collision that instantly finishes the rotation or simply stops the rotation.

    Depends on what you're using to rotate the object (the sprite angle, the bullet behavior angle, ect.).

  • You do not have permission to view this post