(fixed) Trouble getting dsb_animate to work..

This forum is for the Lua scriptable clone of DM/CSB called Dungeon Strikes Back by Sophia. Use DSB to build your own highly customised games.

Moderator: Sophia

Forum rules
Please read the Forum rules and policies before posting. You may Image to help finance the hosting costs of this forum.
Post Reply
User avatar
Joramun
Mon Master
Posts: 927
Joined: Thu May 25, 2006 7:05 pm
Location: The Universe

(fixed) Trouble getting dsb_animate to work..

Post by Joramun »

I'm polishing my two-handed axe by adding some custom graphics,

I have a few separate bitmaps (axe icon, dungeon view, and fly forward, backward and sideways).

Now that I've managed to get the "invisible color" to work, I want to get the flying animation to work, but I have no idea how to do that...
What Is Your Quest ?
User avatar
Sophia
Concise and Honest
Posts: 4307
Joined: Thu Sep 12, 2002 9:50 pm
Location: Nowhere in particular
Contact:

Post by Sophia »

dsb_animate requires that all frames of animation be put together in a sort of "strip," so if your axe has four frames of animation, they should all be in a row.

Then you can do dsb_animate(your_bitmap, 4, delay). Since you've specified 4 frames, then dsb_animate will divide your image into four sections of equal width and show each section in turn, forming the animation.

At the present time, DSB doesn't support making animations from separate images. (though this can change if there is demand for it, of course)

Does this help?
User avatar
Joramun
Mon Master
Posts: 927
Joined: Thu May 25, 2006 7:05 pm
Location: The Universe

Post by Joramun »

I supposed it was something like that but I wasn't sur of how the frames specified.

Thanks a lot ! :D
What Is Your Quest ?
User avatar
Joramun
Mon Master
Posts: 927
Joined: Thu May 25, 2006 7:05 pm
Location: The Universe

Post by Joramun »

Hmm, the animation works almost fine, but it seems the frames cutting is not what I expect :

My axe is on a bitmap of 272 pixel width (4x68)
I copy pasted the four views with the same width, but it seems that in game the frames are overlapping (the edge of another appears at some animation steps) though on the bitmap they are not ! So I suppose the engine takes larger cuts than exact ones, and it might be because of the distance-scaling algorithm.
What Is Your Quest ?
User avatar
Sophia
Concise and Honest
Posts: 4307
Joined: Thu Sep 12, 2002 9:50 pm
Location: Nowhere in particular
Contact:

Post by Sophia »

Hmm... :?:
If you'll send me the bitmap(s) I can take a look at what's going on. :)
User avatar
Sophia
Concise and Honest
Posts: 4307
Joined: Thu Sep 12, 2002 9:50 pm
Location: Nowhere in particular
Contact:

Post by Sophia »

Ok, as we talked about in flashchat, the problem was that the slices were too small, because of rounding errors.

You'll still get them if the original bitmap isn't divisible by the number of frames, but I've changed to algorithm to cut the bitmap and then scale it, rather than trying to cut a scaled bitmap.

If that doesn't make any sense, don't worry about it. The short answer is that I fixed the problem you were observing. :)
User avatar
Joramun
Mon Master
Posts: 927
Joined: Thu May 25, 2006 7:05 pm
Location: The Universe

Post by Joramun »

It makes perfectly sense !

Hah ! This terrible bug was impeding my creative activities !

ok, i was just using some graphics from another game

Next weapon I will make : longspear !
What Is Your Quest ?
Post Reply