Nez: free, open source 2D framework

Thanks buddy. Just to be clear (and I’m not missing out on some other cool Nez feature) when you say “cache your Entities” you mean to set the Entity as a class property of the Scene via findEntity at the start and then access it via that instead of calling findEntity each time?

I believe that’s what I was getting at with my first example when I set it to PlayerEntity and just access it from the scene.

Just want to say thanks for your efforts with Nez.

When i say cache, i just mean do the lookup just once and store the result. You don’t want to be calling findEntity every frame. Store the reference in your Component subclass. No need to subclass Scene and store them there.

Quick question (apologize if asked before), I see that the Nez.Samples window size remains fixed after a change in resolution or when moving from one resolution monitor to a different resolution monitor, I’m trying to get the same functionality but my Nez project changes window size when moving the window from one resolution monitor to a different resolution monitor. Any ideas how to achieve this?

Hey @prime31, loving Nez! Really going to push it (and Monogame) when the project is finished. I think Nez should be officially added to the Monogame family as the optional layer that sits above MG when an EC(S) framework is needed.

Anyway, I’ve used ProjectileMover and noticed the move always returns true because “neighbours” contains the projectile’s collider and then checks overlaps() with itself. Strangely the NezSample NinjaGame works but I think that’s because you’re specifying a layer which I’m not (and I don’t see why specifying a layer would stop it returning itself)?

Wondering if boxcastBroadphase shouldn’t be boxcastBroadphaseExcludingSelf instead?

Here’s the current method for move() in ProjectileMover:

	/// <summary>
	/// moves the entity taking collisions into account
	/// </summary>
	/// <returns><c>true</c>, if move actor was newed, <c>false</c> otherwise.</returns>
	/// <param name="motion">Motion.</param>
	public bool move( Vector2 motion )
		if( _collider == null )
			return false;

		var didCollide = false;

		// fetch anything that we might collide with at our new position
		entity.transform.position += motion;

		// fetch anything that we might collide with us at our new position
		var neighbors = Physics.boxcastBroadphase( _collider.bounds, _collider.collidesWithLayers );
		foreach( var neighbor in neighbors )
			if( _collider.overlaps( neighbor ) )
				didCollide = true;
				notifyTriggerListeners( _collider, neighbor );

		return didCollide;

Late reply, been out of town and off the grid for a few weeks. That could either just use boxcastBroadphase with layers or boxcastBroadphaseExcludingSelf. Same results either way.

1 Like

Hello @prime31 and community :slight_smile:
I somewhat confused about handling Tiled assets and was hoping you can spare a moment of your time for me.
In the YT video about using Tiled you import the assets using Content.mgcb but then I failed to locate required dll’s as well as Nez.PipelineImporter does not seem to be in master any more (?)
Please advise where can I find the required dlls.

From the Nez.Samples I can see that I can load assets directly with LoadTiledMap and set my files to ‘Copy if newer’.
As a newcomer to monogame I have absolutely no idea if there is a reason to go for pipeline importer or stick to loading files directly.

Any advice/info is much appreciated :slight_smile:

Thank you all o7

Nez stopped using the Pipeline tool entirely with version 0.10. You can now load Tiled maps directly. Just look at the Nez.Samples repo for examples.