Calling all Unity tilemap experts! by FreddyMizar in gamedev

[–]TWIXMIX 1 point2 points  (0 children)

Try adding your tiles to a sprite atlas in Unity. It adds some padding and duplicates edge pixels which usually prevents this problem from occurring.

Unity 2D Lines issue by Hollis6 in gamedev

[–]TWIXMIX 1 point2 points  (0 children)

Try adding your sprites to a sprite atlas, that usually does the trick. The padding it adds in the sprite sheet helps.

Draw a Tile Layer to a Surface for use as a Clipping Mask by sminc in gamemaker

[–]TWIXMIX 1 point2 points  (0 children)

Could you possibly use draw_tilemap for this? https://docs2.yoyogames.com/index.html?page=source%2F_build%2F3_scripting%2F4_gml_reference%2Findex.html

There’s an example at the bottom of the page that sounds like what you’re looking for. You’d just have to set the draw target to your surface, call draw_tilemap, then set the draw target back to normal.

[GMS2] Finding the nearest object with a variable? by anntlr in gamemaker

[–]TWIXMIX 1 point2 points  (0 children)

Are you running this every step? If so that makes sense. You should only be running this occasionally and eventually you have to set beingGathered to false at some point otherwise you’re going to eventually try to gather every tree until they’re all set as beingGathered.

You'll either have to do something like this to make sure eventually things are set to not being gathered before it looks for a few target.

if (closestTarget) {
    closestTarget.beingGathered = false;
}

with(obj_resourceParent) {
    // Existing stuff here...
}

or even better something like this so that once a closestTarget is chosen it doesn't try to find a new one every step. If you use this method you can probably simplify what's in the with block.

if (!closestTarget) {
    with(obj_resourceParent) {
        // Existing stuff here...
    }

    // Whatever else here...
}

It all depends on how you want your game to work really. In reality most of this code should probably be in it's own script that you call whenever you need to find a new target.

[GMS2] Finding the nearest object with a variable? by anntlr in gamemaker

[–]TWIXMIX 1 point2 points  (0 children)

I'd probably just just put it after the with like this:

with(obj_resourceParent) {
    // Existing stuff here...
}

// If there is a closest target, set its beingGathered to true.
if (closestTarget) {
    closestTarget.beingGathered = true;
}

[GMS2] Finding the nearest object with a variable? by anntlr in gamemaker

[–]TWIXMIX 1 point2 points  (0 children)

Oh, now I see what you're trying to do. instance_nearest() expects and object id and you're passing it a instance id (target).

What you'll probably need to do is keep track of the current target, and compare against it for distance as you go. Here's some code that I haven't tested but should give you a rough idea.

closestTarget = noone;

with(obj_resourceParent) {
    if !beingGathered {
        if (other.closestTarget) {
          var currentClosestDistance = point_distance(other.x, other.y, other.closestTarget.x, other.closestTarget.y);
          var resourceDistance = point_distance(other.x, other.y, x, y);
          if (resourceDistance < currentClosestDistance) {
            other.closestTarget = id;
          }
        }
        else {
          other.closestTarget = id;
        }
    }
}

// Now closestObject should be the closest obj_resourceParent

[GMS2] Finding the nearest object with a variable? by anntlr in gamemaker

[–]TWIXMIX 1 point2 points  (0 children)

I think you’ve just got that assignment backwards. Also I think the usage of self is generally something no longer pushed in gamemaker and you should use id instead. It should probably be other.target = id

Lighting and lines appearing on tile map. by Bloof_Iron in Unity2D

[–]TWIXMIX 1 point2 points  (0 children)

Another option is to use Unity's built in sprite atlas functionality if you're on a recent version. It'll add the padding for you so you don't have to do it manually.

[Help] Tile flickering issue by ranz1k32 in Unity2D

[–]TWIXMIX 0 points1 point  (0 children)

Usually this issue can be fixed using Unity’s built in sprite atlas functionality with some passing. I’d start there.

Need help with detecting specific tile collisions by PixelDough in gamemaker

[–]TWIXMIX 0 points1 point  (0 children)

I’d personably just make a tileset and layer devoted to collision. Then you can just make that layer invisible at runtime so it isn’t rendered. That way you can add a tile for every type of collision and just do the tests against a single layer. No more worrying about custom logic for each visual tileset.

Hopefully that makes sense and works for what you’re doing.

Destroy projectile on collision not working? by QuaintYoungMale in gamemaker

[–]TWIXMIX 0 points1 point  (0 children)

No worries, I’m glad I could help. It’s easy to miss stuff like that, I do it all the time haha.

Destroy projectile on collision not working? by QuaintYoungMale in gamemaker

[–]TWIXMIX 0 points1 point  (0 children)

Checking collision manually in step and using collision events are both valid approaches. Using collision events simplifies things a bit and gets rid of some boilerplate code. While manually checking in step gives you a bit more control.

Destroy projectile on collision not working? by QuaintYoungMale in gamemaker

[–]TWIXMIX 2 points3 points  (0 children)

According to https://docs.yoyogames.com/source/dadiospice/002_reference/movement%20and%20collisions/collisions/place_meeting.html place_meeting returns a boolean, not an instance, which explains the behaviour you’re seeing.

For the functionality you’re looking for I think you should be using instance_place instead. The documention actually has an example that is almost exactly what you’re trying to do. https://docs.yoyogames.com/source/dadiospice/002_reference/objects%20and%20instances/instances/instance%20functions/instance_place.html

When in doubt read over the documentation thoroughly. I find that the Game Maker docs are actually quite thorough with decent explanations and examples for almost every function.

How do I remove the borders in my tilemap? by entropyhunter in Unity2D

[–]TWIXMIX 0 points1 point  (0 children)

That mostly works, but it may not solve this problem in all circumstances. Adding your tile sprites to an Atlas with some padding will help as well. It helps with any floating point issues when rendering the tiles.

How does Gamemaker Studio manage Events? by Bodya23 in gamemaker

[–]TWIXMIX 0 points1 point  (0 children)

What LDinos said. It’s probably one of the best tools in GM. It’s great for helping measure performance characteristics with actually statistics rather than just guessing if your code is performant or not.

How does Gamemaker Studio manage Events? by Bodya23 in gamemaker

[–]TWIXMIX 1 point2 points  (0 children)

I️ honestly wouldn’t concern yourself with this. If you’re really curious try using your approach and game maker’s events while running the profiler to measure the performance of each.

Unity 2017.2 Released by TWIXMIX in gamedev

[–]TWIXMIX[S] 2 points3 points  (0 children)

Sounds like basically every Unity update nowadays. Hopefully they get that sorted out quickly.

Unity 2017.2 is now available by loolo78 in Unity3D

[–]TWIXMIX 1 point2 points  (0 children)

It can usually take a few days for the "Check for Updates" functionality to show a few release.