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 / Why does this function not work correctly with Create Animated Sprite?

Author
Message
Stygian
14
Years of Service
User Offline
Joined: 6th Jan 2010
Location:
Posted: 2nd Mar 2010 00:50
This is the function working properly:


And now it doesn't work:


The sprite works fine within the program, I have singled out this line of code as the problem, can anyone tell me why Create Animated Sprite is messing this function up?
ShaunRW
DBPro Developer
16
Years of Service
User Offline
Joined: 7th Jan 2008
Location: Brisbane, Australia
Posted: 2nd Mar 2010 13:56
This happens because when you create a sprite, DBPro switches from 2D mode to 3D mode. And when you use 3D you have to say when to render to the screen. You do this by using the Sync On command to turn on syncing. After that you can put Sync when ever you want to render to the screen.

So with your function you want to render to the screen after each letter was printed (At Bottom of the for-next loop).

Here's the code to show you what i mean:



Stygian
14
Years of Service
User Offline
Joined: 6th Jan 2010
Location:
Posted: 3rd Mar 2010 10:34 Edited at: 3rd Mar 2010 10:35
Actually, the entire program has syncs and they seem to work right, but I really wanted to know specifically what "3d mode" entailed, and how to avoid it if possible.

also, the second example does each line before it resets, not each letter. *shrug

Even with syncs it still behaves differently. For instance, I could display a background image, and then if I wanted to use a text command, it would delete the background image as soon as I did. So, everytime I want to add a line of text, or a new image on the screen, I have to re-display EVERYTHING I did previous. Is there just no way around this?
IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 3rd Mar 2010 19:53
You can switch the backdrop off after loading the sprite: BACKDROP OFF

Or (possibly slightly more efficiently), set sprites to not clear the screen or save the background when they are drawn: SET SPRITE 1, 0, 1

Stygian
14
Years of Service
User Offline
Joined: 6th Jan 2010
Location:
Posted: 10th Mar 2010 00:43
Thank you IanM, that worked perfectly. Also, my name is Ian Mackechney... so your name for the forums really confused the poop outa me for a second.

Login to post a reply

Server time is: 2024-09-28 14:29:15
Your offset time is: 2024-09-28 14:29:15