Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / Can't figure out Animation...

Author
Message
Neco
18
Years of Service
User Offline
Joined: 13th Jul 2008
Location: Waterloo, Wisconsin USA
Posted: 21st Nov 2010 02:56 Edited at: 21st Nov 2010 02:57
So I've got my GUI layout loaded into my window (its all 1 image because that's all it realistically needs)

But I can't for the life of me get the Animation commands to work with an Animated GIF, even though it will load that format.. It only displays frame 1 and never anything else.

I've messed with PLAY Animation, PLACE Animation, PLAY Animation TO IMAGE, etc..

What is the simplest way to build an animation, and get it to loop properly? Something that doesn't involve a ton of code, I am hoping.

The animation in question is needed to simulate a blinking cursor on my text entry box area of the GUI.. If everything works out, the plan is to have the cursor move alongside text as it is entered, like a real cursor in a console would.

Or perhaps there is an easier way I have overlooked?

I've tried doing forum searches, but because of the crumby search format I either get no hits, very few hits with useless info, or a page or two full of unrelated stuff having to do with movie files, etc, and other TGC products.

Sasuke
20
Years of Service
User Offline
Joined: 2nd Dec 2005
Location: Milton Keynes UK
Posted: 21st Nov 2010 03:46
Well I've seen this used before:


But apparently it's a hit and miss with some people. Anyway, on the subject of Gif's, animated image formats aren't that widely used in games I don't think, probably because there's not that must control over them. Hence why animated textures are subdivided into frames, so a single image has every frame of the animation on it. Then you could use CREATE ANIMATED SPRITE to play the animation. You can get apps to convert animated gifs into single images. Not sure where though, cause I've never used animated gifs.

A dream is a fantasy, if you achieve that fantasy it was never a dream to begin with.
Neco
18
Years of Service
User Offline
Joined: 13th Jul 2008
Location: Waterloo, Wisconsin USA
Posted: 21st Nov 2010 03:56
Yeah I've seen that code before too.. I'm not really sure what to pick out and what to keep as it has to do with texturing an object it seems, and I don't know much of anything about the various animation commands or how they work..

I haven't looked into sprites yet, but I was wondering if that might be the easiest way to go about it.

I made the GIF myself in photoshop, it's just two frames, one with a black rectangle and one with a white rectangle.. So it wouldn't be hard for me to just make a regular image "sheet" of the two of them like most animations are made of.

I see there are a ton of sprite commands, so I'll have to look into it after I get home from work tomorrow (heading to bed now, sucks when you want to solve something).. I'd Still appreciate any examples or other info from people in the mean time, though

DVader
22
Years of Service
User Offline
Joined: 28th Jan 2004
Location:
Posted: 21st Nov 2010 15:07
I seem to remember gifs working ok many years ago, I designed my logo for games as one. But must admit having less luck more recently and to speed up matters have just used .avi instead. If your gif really is just 2 images then you might as well make an animated sprite or just paste the images down manually.
It really has been years since I used animated gifs and it could be that only DB classic supports them, I honestly can't remember if they ever worked in Pro.

As for the example code above, the object texturing is just a fancy way to show off an animation. Playing the animation to image 1 and texturing the object with the animated image. Works really well for TV screen, Cinema screen effects. DB does this very well and I have had a complete movie playing in the background to some scenes I have made in the past( eg. Cinema level), only demo's but the power is there to have it in game.

http://s6.bitefight.org/c.php?uid=103081
Neco
18
Years of Service
User Offline
Joined: 13th Jul 2008
Location: Waterloo, Wisconsin USA
Posted: 21st Nov 2010 22:33 Edited at: 21st Nov 2010 22:47
Ok I got the animation problem solved, and I made an Animated sprite and got it to show up how I want, and my cursor "blinks" like a cursor should, etc..

EDIT: OK stupid me.. I got my "follow the text" problem solved with text width() :p



I suppose I should also solicit ideas at this time for a problem I need to solve in the future.. My input bar does not go the entire length of the GUI layout image, but even if it did I still need to set up bounds checking, to either stop further input from registering (and stop the cursor at the edge of the screen so it doesn't just fall off), or to start scrolling the text..

I think halting input would suffice as I can't imagine any command in my game being THAT long... although if someone were to ask an NPC a question that might become a problem..

Thoughts and demonstrated ideas / hints on the matter would be greatly appreciated in addition to my cursor offset problem.

Thanks

Login to post a reply

Server time is: 2026-07-21 12:51:16
Your offset time is: 2026-07-21 12:51:16