Post

 Resources 

Console

Home | Profile | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 VBGamer
 VBGamer
 Modifying existing vertices in Directx 9
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

RedMonkeyRon
Neophyte

USA
1 Posts

Posted - Aug 10 2005 :  01:35:08 AM  Show Profile  Reply with Quote
I have a working Pokemon-like 2D game, but it runs like a slug. I based it on this tutorial: http://dotnetforums.net/showthread.php?t=87878, but the tutorial didn't go into how to actually alter the vertices of each sprite. Therefore, to simulate movement, I'm disposing and re-creating 150 sprites for each time the little man moves. Ugh.

I suspect that can just change topleft.x and topleft.y of each vertex (each sprite contains 4) and then re-render the scene, therefore simulating movement. However, I don't know how to edit the vertices in an existing sprite.

The sprite class clsSprite contains:
Private dxDevice As Device
Public SpriteImage As Texture
Public vBuffer As VertexBuffer

Question: How do I reference something life clsSprite.vBuffer.Vertex(x).TopLeftX and edit them? If I can get the performance to a less embarrassing point, I promise I'll put the base code out here. Thanks!!!

Eric Coleman
Gladiator

USA
811 Posts

Posted - Aug 10 2005 :  12:07:42 PM  Show Profile  Visit Eric Coleman's Homepage  Reply with Quote
You don't alter the vertices of the sprite after you create it.

The trick is to use a matrix for each sprite. A matrix allows you to specify things like position (commonly refered to as "translation"), rotation, shearing (like a parrallelogram), and stretching/shrinking.

Look at the directx 9 section here, http://directx4vb.vbgamer.com/ for more information. Of course, you should also consider downloading the Directx 9 SDK. I know it doesn't have any VB.NET examples, but it's still a good source of information.

Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
VBGamer © Go To Top Of Page
This page was generated in 0.16 seconds. Snitz Forums 2000

Copyright © 2002 - 2004 Eric Coleman, Peter Kuchnio , et. al.