UnderwaterApps / overlap2d

Overlap2D Game development toolkit for UI and Level design
Other
780 stars 224 forks source link

Bug: Spriter (scml) animation size #201

Open tomiit123 opened 9 years ago

tomiit123 commented 9 years ago

Hi.

I was going to add simple character animation of Spriter (scml) to Overlap2D (latest) but size of imported object is many times bigger than normal object. So for testing I made simple 100×100 px picture and put to Spriter and save it. After I import it to Overlap2D picture is so big than I have to max zoom out. Also look on marked border of picture in O2D is wierd out of picture. Size of O2D workspace is 800×480 and 80 Pixels per WUnit. Picture is 100×100 pixels and 72 dpi (screen dpi).

scmloutput

o2dspriterbug

azakhary commented 9 years ago

I think the reason is in having 80pixels per unit. somehow spriter animations probably do not adjust. I have to test it. meanwhile if you are just testing, try out on project where it's 1 ppu instead of 80. should be ok.

tomiit123 commented 9 years ago

Exactly what are those Pixels per WUnit? I never get it :D ...its like dpi?

tomiit123 commented 9 years ago

Yes you are right. 1 ppu made thing but I marked Spriter object border is not in place.

o2dspriterbug2

azakhary commented 9 years ago

it's like your world size. you make a level, and it has some "size" and when you work with it's numbers you don't wont to "think in pixels" because pixels are different based on dpi and things like that. so in order to make it easier for you you just make up an imaginary unit, which is world unit. and your world coordinates are in that unit. Now because world is made from textures and textures have actual pixel sizes, you want to have this connection somewhere to let overlap2d know how many pixels are in your imaginary world unit.

The way to think of this is. Say you have all this images that will make up your world. and you think, well I am better off thinking in meters or something. And you say, well this small tree is like one meter tall, as it's half size of my character. so that is a convinient number to work with. your tree texture is say 250 px high, meaning your one meter is 250 px, or call it one world unit. so then, you create your project, and say hey, make 1 unit to be 250 pixels. and then all your coordinates are in your imaginary meters now or something. and you forget about pixels, never think in pixels. when you move something you "code" your velocities in meters and so on.

My preferred number is 3 pixels per world unit. that's a convenient number. Current devices resolution is big, something like 1920x1200 and with 3 pixels per world unit, camera size of 600 on something is pretty convinient to think in.

If you don't care about that stuff, just put it 1. and it'll be all in pixels.

azakhary commented 9 years ago

As for the border it's not in place, because I couldn't figure out how to find the left most point of spriter animation. I am sure it's easy, but because I do not use spriter much, it's like that... :D

tomiit123 commented 9 years ago

Hm cant you simple find center of spriter object divide spriter width / 2 and height / 2 for center.

tomiit123 commented 9 years ago

Hm I see there is many objects in scml file and you cant mesure it like together as object.

azakhary commented 9 years ago

yep..also I am not sure if I should artificially move it so that it's right top of the 0 coordinate or should I keep it in center to 0, but move the bounds... It's complicated anyway.

azakhary commented 9 years ago

can you move the entire thing to 0,0 (right, up) in spriter?

tomiit123 commented 9 years ago

When you creating object in spriter you putting objects according on base 0,0. So yes I can put entire object right up and when Im looking on scml file when your object (one piece of picture) is on 0.0 co0rd. in file hasnt x and y coord. So x,y shows up in file just when you move object out on base 0.0 point. So spriter is mesure object base on 0.0 center. So you have to find in file 2 values for X (min, high) and for y (min, high) so this is for object if is centered. But for this problem you dont need to find spriter 0.0 base point. Just mesure entirely object (find the highest and min values for x and y) and put scml object in the middle.

tomiit123 commented 9 years ago

But your border proportions of marked item are correct just divide it by 2 and put object in the middle x,y.

azakhary commented 9 years ago

Yeah, something like that should be done, should not be hard imho. but I have so much other things to do. Let's ho we eventually get to it. Or, you can contribute :-p

tomiit123 commented 9 years ago

Im put object in spriter to up right and now it has correct border but now in animation presentation is moved up right (RED SQUARE).

o2dspriterbug2

tomiit123 commented 9 years ago

Yes I wanted to but I have not many experiences with github and I dont want to brake something :D . But I can look at this :)

tomiit123 commented 9 years ago

I want to contribute but I dont know how to :D . I forked o2d and clone it to my pc. But when I make some changes I have to push it or commit or what :D

azakhary commented 9 years ago

Oh that's simple, here is how it works: you do some changes, then you commit them, then you push them to your fork. this is done via - git push origin master

then when it's on your fork, you do a "pull request". Pull request's are done via button "create new pull request" here - https://github.com/UnderwaterApps/overlap2d/pulls here you choose to do a pull request form your fork to our original repo. when that is done, I will see it as a request form you to merge your codes with repo. I will test them, and if all is good, will click merge, and everyone will have that :)

tomiit123 commented 9 years ago

Nice :) thanks.