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.

Newcomers DBPro Corner / how to put text in front of animation

Author
Message
Help creating a FPS
15
Years of Service
User Offline
Joined: 21st Oct 2009
Location:
Posted: 23rd Nov 2009 01:53
Ok, I've been searching the forums for 3 days now trying to figure out how to get my text to display in front of an animation. The animation is an .avi. I found some stuff about making the animation a sprite, but from what I can tell, even the create animated sprite command is still for images and not actual video animations. If someone could give me a pointer that might help that would be cool.


Nathaniel
Rich Dersheimer
AGK Developer
15
Years of Service
User Offline
Joined: 1st Jul 2009
Location: Inside the box
Posted: 23rd Nov 2009 14:44 Edited at: 25th Nov 2009 06:10
That while loop only ends after the animation stops. if you put the text statements inside the animation loop, that should work, although I've never used an animation, so I'm not sure how well text shows up over one.

EDIT: Interesting. You don't need a sync command for animations. This code...



...shows how you can put text over an animation playing to an image that is textured onto the backdrop. You could also put the animation on a polygon instead of the backdrop.

Also note that I've shortened the path to your AVI. If you don't need the full path, then just pointing to the media folder is good enough.

Help creating a FPS
15
Years of Service
User Offline
Joined: 21st Oct 2009
Location:
Posted: 24th Nov 2009 03:35
I tried this, but I got an error that said that "texture backdrop 1" was obsolete. When I delete that line of code I get my text with plain blue blue background and no animation. I'll play around with it more to see if I can get it to work.

Nathaniel
pcRaider
17
Years of Service
User Offline
Joined: 30th May 2007
Location:
Posted: 24th Nov 2009 03:53 Edited at: 24th Nov 2009 03:53
This, I am works.

Rich Dersheimer
AGK Developer
15
Years of Service
User Offline
Joined: 1st Jul 2009
Location: Inside the box
Posted: 24th Nov 2009 06:30
"texture backdrop" is an old command that was taken out, but then put back in for the latest version. I believe it was put back for the Dark Clouds plugin. Anyway, if you are updated to the latest version, it should work.

Help creating a FPS
15
Years of Service
User Offline
Joined: 21st Oct 2009
Location:
Posted: 24th Nov 2009 18:56
Thanks for everyones help! I got it figured out, but it took a mixture of what everyone said. I appreciate everyone who took time to help me out

Nathaniel
Help creating a FPS
15
Years of Service
User Offline
Joined: 21st Oct 2009
Location:
Posted: 25th Nov 2009 03:40
Ok, I ran into another problem and i figured I might as well just post it here before I make a whole new thread. I ran into a thread that covered this problem, but I cannot find it again. I have made a menu and I have text. I have coded the text to be selected when I push the up or down keys. My problem is that as long as I hold the key down it is selected, but as soon as I release the key it deselects. I want it to stay selected until I push another button.




Nathaniel
Rich Dersheimer
AGK Developer
15
Years of Service
User Offline
Joined: 1st Jul 2009
Location: Inside the box
Posted: 25th Nov 2009 06:07 Edited at: 25th Nov 2009 06:08
A couple of things...

If you loop the animation, you don't need to play it.

If you are looping it then you don't need to check if it's playing, it will be playing until you tell it to stop.

It looks like you want to pick between two menu choices, PLAY and CREDITS. Looping to capture UPKEY and DOWNKEY is fine, except, as you noted, the color changes back when you stop pressing the key.

You might want to use a "flag" to tell which key was pressed, then set the color according to the flag. Like thus...



Now, that code is pretty basic, and I'm sure others here can suggest some clever and tricky ways to do the same thing. But if you are trying to learn DarkBASIC, then you might do well to start with small, easy steps, and build up to the tricky stuff.

Help creating a FPS
15
Years of Service
User Offline
Joined: 21st Oct 2009
Location:
Posted: 25th Nov 2009 19:37
@Rich

Thanks, that makes a lot of since. I did not know about looping and playing the animation. That if I did one then I didn't need to do the other. I understand now and this code works great. Thanks!

Nathaniel
IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 25th Nov 2009 22:13
Quote: "You don't need a sync command for animations."

Sorry, but yes you do.
With the example code you have you aren't taking control of the animations, so DBPro will do it for you automatically at various points.

The next release of my plug-ins will allow you to take manual control over exactly when the animations are drawn, so you'll be able to do some 2D stuff, draw animations, then draw some more 2D stuff etc. I've added the same controls for sprites too.

Rich Dersheimer
AGK Developer
15
Years of Service
User Offline
Joined: 1st Jul 2009
Location: Inside the box
Posted: 25th Nov 2009 22:47 Edited at: 25th Nov 2009 23:04
@IanM - Well, you can play an animation without using a sync command in your code, I just did it, I know it works. Agreed that if you don't use sync commands, then DBPro is still controlling the sync.

But that first snippet I posted DOES work, if you are using a verison of DBPro that has TEXTURE BACKDROP as a valid command. I've run it too, and I know it works fine, text appears over my playing animation file, no sync command in the code.

So I guess my statement was incomplete... you don't need a sync command to show the animation in that first snippet, but sync is still being generated, by the program, as it does whenever you don't include a sync command in your code.

Does that sound right?

FURTHER EDIT: Really glad to hear you're still working on the plugins, can't tell you how much easier it is to code with them!

IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 26th Nov 2009 20:37
Sorry, didn't mean to imply that it didn't work. All I was pointing out was that even though you didn't use an explicit SYNC command, DBPro was carrying out implicit calls to this command for you.

Quote: "Really glad to hear you're still working on the plugins, can't tell you how much easier it is to code with them!"

You're welcome

Login to post a reply

Server time is: 2024-11-24 23:02:52
Your offset time is: 2024-11-24 23:02:52