Spriter importer and collision or getting objects

Monkey Forums/Monkey Programming/Spriter importer and collision or getting objects

Playniax(Posted 2013) [#1]
I am playing around with this again and I would like to add some kind of collision handling.

What is the best way to get a certain part of the sprite. For example the sword relative x and coordinates, width and height so can make some collision stuff?

Also the complete width and height of a sprite would be great :)

Or I should hack something together myself...

I have made this little demo with Spriter importer and Ignition:

http://www.playniax.com/share/demos/spriter/MonkeyGame.html


therevills(Posted 2013) [#2]
The complete width/height of a sprite is a bit tricky but we should be able to calculate it somehow.

RE: Getting objects, I've been meaning to add something like what Slotman did over on bb.com:
http://www.blitzbasic.com/Community/post.php?topic=99983&post=1177496

Collision data is meant to come in a future version of Spriter, but we should be able to get the each objects location, width and height and do at least a bounding box collision check.


Playniax(Posted 2013) [#3]
Okay, I am going to take a look. If I know the width /height of all objects and the relative positions it's not so hard to calculate the complete width/height. I did this with my scrollbox :)


therevills(Posted 2013) [#4]
If I know the width /height of all objects and the relative positions it's not so hard to calculate the complete width/height.

But what about rotation and scale of the objects, since these can be changed during the animation... it depends on if you want a rough size or a size at a set point in the animation.


Playniax(Posted 2013) [#5]
Ah yes, rotation can make it tricky ;)

For me would be more interesting to get the individual objects width/height/scale/rotation and relative pos to have some kind of collision handling then.


rIKmAN(Posted 2013) [#6]
Any progress on this?


SLotman(Posted 2013) [#7]
I am. Yesterday I just developed a way to change "objects", or even attaching one to another... shame I can't post everything, since it's tied to custom libs I'm developing under contract :(

But I think it's ok to post this, should help people out:


You could have another function that solves filenames into folder/file ints and then you can manipulate spriter objects all you want :)

Reading this thread was a nice reminder that I need to make some bounding box/bounding sphere generator for spriter animations :)


therevills(Posted 2013) [#8]
Hey Slotman, would you like access to the repo, so if you want you can commit changes/fixes?


SLotman(Posted 2013) [#9]
Thanks, but:

- I have no idea how to use git
- I'm under contract, so most of my code can't be shared :(
- I'm still using a really old version of the importer, one that doesn't even have bones!

And one thing I couldn't "fix" so far: when I attach an image into another, it's moving around just "a little bit" (seems to be less than a pixel?) during the animation. It's nothing too distracting (specially at 1x zoom), but does shows that it's an object on top of another :/


therevills(Posted 2013) [#10]
- I have no idea how to use git

I dont like Git, I use Hg :)
- I'm under contract, so most of my code can't be shared :(

Fair enough.. offers there to you and anyone else :)
- I'm still using a really old version of the importer, one that doesn't even have bones!

Any reason why?


SLotman(Posted 2013) [#11]

Any reason why?



Nothing particular... I just started working on that, and now I have way too much stuff built on top of it ^_^