Jump to content
Spriter Forums

SpriterDotNet - An implementation for all C# frameworks


loodakrawa

Recommended Posts

2 hours ago, sadqwe0 said:

I understand that, but let's say I want to swap the head sprite out with the foot sprite. How do I reference the Animator's sprites to tell it which ones to swap?

Ah, that makes more sense :-D

It depends on your architecture but I'd say you should do that when you load the sprites. In the example, all the sprites are loaded using an instance of SpriterContentLoader which gives you a lot of caching and sensible defaults out of the box. However, in a real game you probably want custom loading, especially if you want to control individual sprites.

If you want to use that and just get a sprite, you can get it from the IAssetProvider's Get method with the given folder and file id.

Hope this helps

Link to comment
Share on other sites

  • 1 month later...

Hi,

I'm trying to make a simple game, using monogame and Spriter, and since this is my first game I don't have a lot of experience. I have a problem , which I think is easy to resolve, yet I'm unable to find the answer. I'm trying to write a simple collision detection, and I don't know how to get a rectangle from entity. I've read that Collision rectangles are controlled in Animator, but I don't really know what to do with it. I know that this is probably quite easy, but I would really appreciate some help.

Link to comment
Share on other sites

7 hours ago, Ethealoner said:

Hi,

I'm trying to make a simple game, using monogame and Spriter, and since this is my first game I don't have a lot of experience. I have a problem , which I think is easy to resolve, yet I'm unable to find the answer. I'm trying to write a simple collision detection, and I don't know how to get a rectangle from entity. I've read that Collision rectangles are controlled in Animator, but I don't really know what to do with it. I know that this is probably quite easy, but I would really appreciate some help.

Hi,

ATM it's not really trivial to get that information out with the current version. This is something that has been requested a couple of times but I've been unable to find the time to implement. However, I have some time these days so I opened a ticket about this which I hope to implement in the next couple of days. Stay tuned!

Link to comment
Share on other sites

10 hours ago, Ethealoner said:

 

My Geometry-Fu was strong today so I've pretty much done it. It's in a branch for now but I'm pretty positive I'll merge id in the main branch soon. I assume you want something like this. I had to come up with a new data structure since the MonoGame Rectangle is axis-aligned but hopefully this should be fine to use.

Link to comment
Share on other sites

5 hours ago, loodakrawa said:

My Geometry-Fu was strong today so I've pretty much done it. It's in a branch for now but I'm pretty positive I'll merge id in the main branch soon. I assume you want something like this. I had to come up with a new data structure since the MonoGame Rectangle is axis-aligned but hopefully this should be fine to use.

I can't test this right now, but from what I've seen at github, that's exactly what I was looking for. Thank you very much, you are amazing !

 

Link to comment
Share on other sites

  • 1 month later...

Hi Looda!

First off, thank you so much for the plugin! I was wondering if you'd have any ideas on how to fix an issue I'm having.

My animations work just fine in unity until I enable animation blending. When I do, parts of my characters will disappear and reappear, as seen in the gif below (the other picture shows the error messages I get).

I made sure that the bone hierarchy and z-order is consistent throughout all the animations. I've also created and tested other animations to confirm that smoothing does indeed work without the disappearing act; I think it's just a problem with something I did in the files at one point.

I've tried to change things I thought could be causing the issue, such as stretching sprites without bones, but nothing helps and I'm facing redoing all the animations I've made up to this point. That's fine, but moving forward without knowing what I did wrong makes me uneasy about repeating my mistakes. Have you heard about this problem from others?

vrDDQ9e.gif 

dasfg.jpg.e9d2dd67dcc96ccfddaf85bbbe594b2a.jpg

Link to comment
Share on other sites

Hi Looda,

thanks for the nice monogame implementation.

is there a easy way to get action point information?

i use this as helper method:

public Vector2 GetPointPosition(string pointName) {
    if (hasPoint(pointName)) {             
    	return new Vector2(
            animator.FrameData.PointData[pointName].X,
            animator.FrameData.PointData[pointName].Y);
    }
    return Vector2.Zero;
}

private bool hasPoint(string pointName) {          
    return animator.FrameData.PointData.ContainsKey(pointName);
}

but this gives me only the original spriter point without scaling, flipping or rotation from the base animation.

So my question is: Is there a way to get the transformed action point or a helper to do this for me?


Background:
Im making a mono game with mouse aim (run and gun style). So i m having a player animator with feet, body and head.
And a 2. animator with the arms and gun animation. i rotate the arms animation to point toward the mouse.
animationArms.Rotation = rotation;
But the action point at the gun for spawning bullets is not rotated.


regards alex

Link to comment
Share on other sites

On 15/07/2017 at 10:20 PM, mr_tawan said:

Hi Loodakrawa.

May I ask, do you have an ETA for the next release? If possible I'd like to shy away from doing my own builds. 

I don't mean to rush you or anything :)

Thank you.

Hi,

I'll do the MonoGame version soon (next couple of days) - I converted things to .NET Standard so I'm figuring out how best to package everything. As for Unity, I put it on hold until .NET Stadard 2.0 comes out and Unity starts supporting it.

Link to comment
Share on other sites

  • 2 weeks later...
2 hours ago, alex2020 said:

My MonoGameAnimator does not have a public Method GetPosition as shown in your link.

I am using the nuget Package 1.6.0

Am i missing something?

Yes you are :-D

That method was added after that release. However, I just did the 1.6.1 release yesterday which includes that method. FYI, for this release I moved everything to .NET Standard libraries and did proper packaging.

https://www.nuget.org/packages/SpriterDotNet/
https://www.nuget.org/packages/SpriterDotNet.MonoGame/

I also added the content importer as a package. Hopefully that helps with the Content Pipeline weirdness.
https://www.nuget.org/packages/SpriterDotNet.MonoGame.Importer/

Please let me know if there are any issues with these packages.

Cheers

Link to comment
Share on other sites

I´m currently using Portable Class Libraries for my shared code in monogame.
If i update your package in nuget to 1.6.1 it tries to install around  30 .net packages and fails.

Would you recommend to create a new shared project in .Net Standard and copy my old shared code over?

 

Link to comment
Share on other sites

7 hours ago, alex2020 said:

I´m currently using Portable Class Libraries for my shared code in monogame.
If i update your package in nuget to 1.6.1 it tries to install around  30 .net packages and fails.

Would you recommend to create a new shared project in .Net Standard and copy my old shared code over?

PCLs are a pain :?

Yes, I recommend .NET Standard because everything is moving in that direction, especially with .NET Standard 2.0 coming out soon. More and more libraries are getting converted to .NET Standard and even Unity3D promised to add support for it which tells you something (since they've been stuck on .NET 3.5 since forever).

Also, from my experience, .NET Standard libraries have no major issues accepting PCL NuGet dependencies in contrast to the other way around. Keep in mind that you'll probably need to add "Microsoft.NETCore.Portable.Compatibility" as a dependency if you're adding PCLs to a .NET standard, at least I had to do it do add MonoGame Portable as a dependency.

Link to comment
Share on other sites

  • 2 weeks later...

Any idea why I get this error:

NullReferenceException: Object reference not set to an instance of an object
SpriterDotNetUnity.UnityAnimator..ctor (SpriterDotNet.SpriterEntity entity, SpriterDotNetUnity.ChildData childData, UnityEngine.AudioSource audioSource) (at Assets/SpriterDotNet/UnityAnimator.cs:35)
SpriterDotNetUnity.SpriterDotNetBehaviour.Start () (at Assets/SpriterDotNet/SpriterDotNetBehaviour.cs:58)

 

thanks!

Link to comment
Share on other sites

13 hours ago, Fletcher Studios said:

Any idea why I get this error:

NullReferenceException: Object reference not set to an instance of an object
SpriterDotNetUnity.UnityAnimator..ctor (SpriterDotNet.SpriterEntity entity, SpriterDotNetUnity.ChildData childData, UnityEngine.AudioSource audioSource) (at Assets/SpriterDotNet/UnityAnimator.cs:35)
SpriterDotNetUnity.SpriterDotNetBehaviour.Start () (at Assets/SpriterDotNet/SpriterDotNetBehaviour.cs:58)

 

thanks!

I assume it's just Unity being dumb as it occasionally happens. I recommend just deleting the currently imported animation and re-importing it again. If it still happens, I'll need more info - like what's null and what happened during the import of that particular thing.

Hope this helps

Link to comment
Share on other sites

Hi Loodakrawa.

There is a neat feature in unity's animation system called Avatar Masks.
As far as I understand, these Avatar Masks allow you to disable certain bones during animation blending, which is really helpful if you, for example, need to use different animation clips for separate body parts (i.e. "swing a sword" while legs are "running", without creating additional animation clips for that specific case).
So my question is: Is it possible ATM to achieve similar functionality wtih your plugin?

Thanks in advance.

Link to comment
Share on other sites

On 8/16/2017 at 1:00 AM, Andrey said:

Hi Loodakrawa.

There is a neat feature in unity's animation system called Avatar Masks.
As far as I understand, these Avatar Masks allow you to disable certain bones during animation blending, which is really helpful if you, for example, need to use different animation clips for separate body parts (i.e. "swing a sword" while legs are "running", without creating additional animation clips for that specific case).
So my question is: Is it possible ATM to achieve similar functionality wtih your plugin?

Thanks in advance.

Hey, at the moment this is not supported out of the box. I think you might be able to emulate this behaviour with Spriter's sub-entities.

In the future, I plan to add a bunch of more advanced features but I'm quite time constrained so I'm not sure when that's going to happen.

Link to comment
Share on other sites

8 hours ago, mr_tawan said:

Just upgraded the version today and MonoGame just stopped working. Looks like MG does not support .Net Core/.Net Standard quite yet.

There's no error or exception though.

What exactly is happening? No errors or exceptions seems very strange.

It shouldn't have anything to to with MG itself but your runtime environment. That being said, I plan to update everything to .NET Standard 2.0 (which is supposed to be awesome) any day now.

Link to comment
Share on other sites

On 8/17/2017 at 6:20 AM, loodakrawa said:

What exactly is happening? No errors or exceptions seems very strange.

It shouldn't have anything to to with MG itself but your runtime environment. That being said, I plan to update everything to .NET Standard 2.0 (which is supposed to be awesome) any day now.

You're right. My setup seems to be messed up.  It used to work until I upgraded Spriter.Net. I've added the MonoGame.Framework.WindowsDX to the Nuget and it works again.

I guess that's what missing.

Link to comment
Share on other sites

  • 2 weeks later...

I created a new library in dot net standard 2 and copied my code over.

The code is working (no Errors) and spriter.net 1.6.1 is includet  via nuget.

My Android and windows game projecty include the lib and complain that monogame is not compatible with dot net Standard 2.0. (or 1.0)

How is your project Setup for such a case?

 

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...