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 / Help with 'UV'!

Author
Message
SPI
14
Years of Service
User Offline
Joined: 3rd Jun 2010
Location:
Posted: 4th Jun 2010 06:50
Hi there guys,

I am new to DarkGDK and I am hoping for a miracle. I have to set up a game and submit by the end of tomorrow night for a course I am taking at my university.

Anyway that's the sad part, here's the kicker:

I can't understand the concept behind UV in 2d game design. I was going through the Space Invader tutorial and they played around with the UV field to display the text during the start of the game.

Why not just go with dbPlayAnimatedSprite() and limit the range of the rows to be displayed to just one character. As in (5,5) that wouldn't show any other text besides the one that's at the 5th position right? Why go with UV at all? Right now I gotta beat it and hit work.. but hopefully someone here can detail me.

Thanks in advance blokes.
Hassan
15
Years of Service
User Offline
Joined: 4th May 2009
Location: <script> alert(1); </script>
Posted: 4th Jun 2010 11:20 Edited at: 4th Jun 2010 11:22
Well, a 2d sprite is simply a plain, with 4 vertices, and usually (without messing with uvs) that plain has UV coords like this:

_________________________________________
* = vertex
_ = index
. = empty

0,0......1,0
*______*
|........./...|
|......./.....|
|...../.......|
*______*
0,1......1,1
_________________________________________

and thus, this plain uses the whole image, since it's UVs are covering 0,0 to 1,1 in the image, modifying the UVs will change the results, as you saw in the Dark Invaders tutorial
the animated sprite would too big, as it will hold over 10 backdrops, which is actually too large, heavy for loading, using UVs is way way faster and more efficient

SPI
14
Years of Service
User Offline
Joined: 3rd Jun 2010
Location:
Posted: 4th Jun 2010 12:37
Alright, so how do I go about selecting a specific section of the plain? I would obviously have to change the position of the verticals to hover around the specific zone right? How would I go about trying to deduce the mathematical values I would need for manipulating the vertices in order to make them surround the zone?

Login to post a reply

Server time is: 2024-07-04 10:43:21
Your offset time is: 2024-07-04 10:43:21