Hello, can XMLTemplateMaker write the data to the xml file?
It does exactly the opposite: it reads the XML into a strongly typed object at runtime.
In other words, I canât use it to save the runtime data. If so, how do I save the data to xml using nez.
The same way you would any C# program: use any of the various XML classes in the .NET framework or a third party XML lib.
Thanks for your reply.
Hello, I have a problem about Nez.UI. I create a entity as my player and I add the CameraFollow to the player.The problem is that when my player moved and the camera followed,but Nez.ui is not working.For example, button.onclick is not working.
I got it. I change the inputpos.The button is working.But I donât know that if so, are there other bug about nez.ui.
Does NEZ have support a on screen virtual joystick and buttons? I want to create a game for android and I need to draw a buttons and joystick on screen.
I can not find this feature in NEZ.
I donât want to make a job that already has done by others.
Virtual joysticks and buttons are very game specific features (and not very difficult to make). If you are looking for anything that game-specific Nez isnât for you. It is a framework meant to be built upon, not just parts you glue together randomly to make a game.
Hey @prime31, fantastic framework from what Iâve seen so far and Iâm thinking of moving my current project over!
Can I just ask what would you do if you needed one entity (or entity system) to have access to another entity?
Iâm struggling to see how I would write a game where entities wouldnât need direct access to other entities at some point yet with ECS I donât see many examples.
Two examples I did see in the Nez Samples was calling a method on the scene to launch missiles or using an Entities access to itâs parent scene as a way to then get access to another entity. Is that the preferred way or should I be looking at design pasterns that avoid this completely?
Sounds like skipping the ECS is a good idea if you already have code you are moving over. Just use the standard EC, which is really how Nez works best. You can then find other Entities and Components via the Scene.
Cool! So you think Nez works best as per your samples of having components contain logic and not just data?
If a component wants to update the property of a component on another entity you would happily do something like this in a ShipComponent:
((GameScene).entity.Scene).PlayerEntity.getComponent().Score += 100;
or
entity.scene.findentity(âplayerâ).getComponent().Score += 100;
I actually have a bunch of âmanagerâ classes for things like generating planets, which I thought may lend itself quite well to Systems but will probably work fine as ECâs on the scene themselves.
I wouldnât go that route. Just use findEntity at Scene start and cache your Entities
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.
Hello @prime31 and community
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
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.