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.

Dark GDK / dbPasteSprite

Author
Message
Mister Fuzzy
13
Years of Service
User Offline
Joined: 27th Feb 2011
Location: XNA
Posted: 25th Oct 2011 06:54
So... Just a quick question...

I'm using dbPasteSprite for my multi-layered Tileset-Platformer engine I'm working on, and I just need a few things clarified about dbPasteSprite.

First off, having called dbDrawSpritesFirst, will regular sprites that are playing over the pasted screen retain the background state after being moved? Or will I have to paste everything again?

Second, do I have to paste everything every cycle? Or can I paste it once and trust that it will stay there until the screen is cleared with dbCls()?

And third, can I paste individual frames of an animated sprite? I already tried this, but nothing showed on the screen. Maybe I was doing something wrong...
Hawkblood
14
Years of Service
User Offline
Joined: 5th Dec 2009
Location:
Posted: 25th Oct 2011 15:35
First, you won't be able to use the sprite collision commands the way you would normally. If you are using these commands, you will need to litterly position the actual sprite for each of the instances of that sprite to make the collision check. It's not as hard as you might think.
Second, you will have to paste them every frame.
Third, you have to set the frame of the animated sprite and then paste the sprite.

Remember, you have to use dbSync();
Make all your original sprites before your game loop.
Make variables (I would use a class) to contain the location (and other info) of the "object" the sprite represents.
In your loop:
Do your input somewhere in you loop.
Move and animate all your "objects".
Paste your background.
Paste all you "objects".
dbSync();

The fastest code is the code never written.
Mister Fuzzy
13
Years of Service
User Offline
Joined: 27th Feb 2011
Location: XNA
Posted: 26th Oct 2011 03:03 Edited at: 26th Oct 2011 03:06
Thanks for clarifying, Hawkblood!

Quote: "you won't be able to use the sprite collision commands the way you would normally"

Then it's a good thing I don't intend on doing my collision checking normally. Since my engine is for a VERY simple-yet-deep game, collisions will be detected by a BLACK outline over solid objects, DARK RED for platforms, and DARK GREEN for climbable walls. Since the backdrop is cube-based, I don't have to worry about any discrepancies caused by rounded-edge tiles.
Maybe later in development, I can add an "overlayer" that is pasted AFTER collision checking has been done to show rounded edges, special effects, etc.

Tunnel vision yet? Have a carrot!
Alex_Peres
AGK Master
15
Years of Service
User Offline
Joined: 13th May 2009
Location: The Milky Way Galaxy
Posted: 28th Oct 2011 20:26 Edited at: 28th Oct 2011 20:32
Quote: "Remember, you have to use dbSync();
Make all your original sprites before your game loop.
Make variables (I would use a class) to contain the location (and other info) of the "object" the sprite represents.
In your loop:
Do your input somewhere in you loop.
Move and animate all your "objects".
Paste your background.
Paste all you "objects".
dbSync();"

I've created my game like you said, just dbPasteSprite, but now I have one problem!
My game lags on slow computers! On fast computers - everything is fine, FPS is 60. On slow comps FPS is about 30! And all game is really slow. (Creatures in game are running like drunks!)

What can you suggest to me?

P.S. other games which have a better graphics runs fine!!!
Hawkblood
14
Years of Service
User Offline
Joined: 5th Dec 2009
Location:
Posted: 29th Oct 2011 05:40
Let me guess. You are using unique sprites for each spot?
If there are sprites that are redundant, you can paste it multiple times. Also, you don't need to render sprites outside of the screen's view.

Also, you have to use time-based movement so that no matter how fast or slow the computer is, it takes a specific time to go from A->B.

The fastest code is the code never written.
Alex_Peres
AGK Master
15
Years of Service
User Offline
Joined: 13th May 2009
Location: The Milky Way Galaxy
Posted: 30th Oct 2011 11:59
Of course not! I use each sprite many-many times!
Mister Fuzzy
13
Years of Service
User Offline
Joined: 27th Feb 2011
Location: XNA
Posted: 30th Oct 2011 18:17
Alex, how are you pasting your sprites? Are you pasting the ENTIRE map? Are you just pasting what is on-screen? Since MY problem is solved (for now), I'd love to help you: I know how it feels to have a game made that unexplainably runs at a slower-than-should-be-possible speed. Especially with 2D. Now that I think about it, I have honestly never had a problem running 3D resources: All my problems lie with 2D. Huh. Weird.

Tunnel vision yet? Have a carrot!

Login to post a reply

Server time is: 2024-10-02 21:36:33
Your offset time is: 2024-10-02 21:36:33