[Kde-games-devel] Kapman sprite system (also, connecting-tiles systems)
Kleag
kleag at free.fr
Thu Dec 11 22:25:21 CET 2008
Le Thursday 11 December 2008 00:34:04 Matthew Woehlke, vous avez écrit :
> kleag at free.fr wrote:
> > The solution in KsirK is intermediary: Everything is in one svg and
> > there is one element with id by object but then all the frames of the
> > object are in the same element. The information on how to cut the
> > object in individual frames is found in the world.desktop file. I
> > don't like to have parseable ids. For me, ids are atomic pieces of
> > information.
>
> People complained when I wanted to put that information in the .desktop
> ;-). And TBH I think it is more convenient in the svg, but I'd welcome
> suggestions if someone thinks they have a better idea.
Is there a possibility to add "user" elements, maybe RDF in a SVG file ? In
that case, you could put the semantic in the RDF and keep the id as what it
should be (IMO), an identifier
>
> > The attached image shows the element with id "exploding"
> > in the svg and its description in the .desktop is below: [exploding]
> > frames=4 height=32 id=exploding versions=2 width=32
>
> I take it you *do* use pixmap splitting, then? I guess I should try to
Yes, sure, but I don't have to render the full graphics and then cut it in
sprites. I render the object element with all its frames and then split this
one.
> remember to give you a nudge if/when I have a usable frame-extracting
> class, I wonder if you would be interested. (Actually... I think you
> would be able to use it directly. I am already anticipating that it will
> need a method that takes maybe an id for reference point but raw offsets
> and width/height; you could certainly use that method with your existing
> id's, no offset, and calculated width/height to extract frames as in
> your sample.)
I'll sure will consider any interesting solution, but really, I'm not for a
"one object and absolute coordinates". I prefer the "one id by object"
solution when possible. I'm not sure I understand well your statement above.
What do you mean by "raw offsets and width/height" ?
>
> > The AnimSprite class is a QGraphicsPixmapItem and itr also contains a
> > list of pixmaps for the frames. Then a slot connected to a timer
> > (local to the sprite ; should it be global ?) calls setPixmaps
> > regularly.
>
> Oy. For Kapman, I was certainly planning to have a global timer (if I
> have to start implementing my own animation logic, anyway). I'm also
> assuming that it will allow skipped frames, so I am wanting to handle
> all animation globally. (But I guess you are dealing with sprite
> positioning/movement separate from animation, which simplifies things.)
>
> Please keep in touch, it sounds like you could probably help me a bit on
> the actual animation side :-). Especially with possible code-sharing. I
> know how I want to get frames out of the svg, and what I want to be
> possible animation-wise, but rather less how to actually accomplish the
> animation ;-).
Sure, ask when needed ! It's really simple for now. Everything is in
animsprite.cpp
(http://websvn.kde.org/trunk/KDE/kdegames/ksirk/ksirk/Sprites/animsprite.cpp?view=markup),
mainly in the sequenceConstruction and nextFrame methods. But it's also very
dependant of some ksirk peculiarities.
Bye.
Gaël
>
> --
> Matthew
> Please do not quote my e-mail address unobfuscated in message bodies.
--
KsirK - a world domination strategy game
http://techbase.kde.org/Projects/Games/Tactic_and_Strategy/KsirK
KGraphViewer - a GraphViz dot graphs viewer
http://extragear.kde.org/apps/kgraphviewer
More information about the kde-games-devel
mailing list