Jump to content
Xtreme .Net Talk

ThePentiumGuy

Avatar/Signature
  • Posts

    1152
  • Joined

  • Last visited

Everything posted by ThePentiumGuy

  1. Here's some source code I found on my book: Do While Not Gameover If system.Environment.TickCount - LastTick >= 1000 / DesiredFrameRate Then <Other Rendering Code> lastTick = System.Environment.TickCount End If Application.DoEvents Loop
  2. www.moon-labs.com :). Go to articles, he has a nice page on Mesh animation and Skinned Mesh animation. Unfortunately this in Unmanaged C++ :(.
  3. "NULL" in C# = "Nothing" in VB.NET :).
  4. Isn't this called Ray Tracing? I know that there is a sample on the DirectX 9 SDK for this :). Also look here: http://www.google.com/search?hl=en&ie=UTF-8&q=Ray+Tracing+DirectX9+Tutorials
  5. You're using DirectInput - it "takes over" your keyboard functions and such. Be sure that you're not having any errors, did you forget to instantiate..etc. The DInput class I gave you - did you remember to type in DInput.Poll() and use that CheckForKeyPress() sub? -The Pentium Guy
  6. Err, I realized that the post title was "Associating Matrix with Shape" - so it might have been hard to search. But anyways, here's the thread link: http://www.xtremedotnettalk.com/showthread.php?t=87596
  7. You could check out the DirectX tutorials in the tutors section (the same ones from my site, www.vbprogramming.8k.com) The code is very similar to loffen's code :). (hmmmmmmm guess where HE learned DirectX from hehe). If you need any more help - feel free to post here :). By the way dude: Just out of curiosity, where did you learn DPlay from? I've been wanting to buy a networking book for a while -The Pentium Guy
  8. Nono man :). This is not how you move the sprite. There is something called World Transformations. In order to move the sprite, you must move the WORLD. For example, if the sprite is at 0,0,0. dxDevice.Transform.World = Matrix.transformation(2,0,0) would move the sprite over 2 units to the rihgt. dxDevice.Transform.World = Matrix.Multiply(dxDevice.Transform.World, Matrix.Translation(2,0,0)) would move the sprite 2 units to the right - each time the line gets executed. (If you put it in the render loop, it will move 2 units each frame) The first line dxDevice.Transform.World = Matrix.transformation(2,0,0) will only move the world to that point. No matter how many times you execute it, it will only move it to the right once... err its confusing - but experimenting with the code should help you understand. "In order to move the sprite, you must move the WORLD." - heh, I'm 100% sure the next question you will ask is: "If I have to move the WORLD to move 1 character, how do I move 2 characters if they wish to go in opposite directions?" -There's a post on the forum which i answered, just search for it :). -The Pentium Guy
  9. That's precisely why I use a different mail for that! ;). Just kidding - I think it has to do with signing up for various things. For example, ZoneAlarm asks you to enter your email for when you install it - im sure this is their way of "Spyware" - they ask for your mail and give it to 3rd party peeps which give it to someone else which in turn sends those kinds of mails to you and ZoneAlarm (and other programs/sweepstakes/mailing lists/ possibly some forums) makes the profit.
  10. heh :-O! I guess i skipped that over ;).
  11. Thsi si what I do: Dim ColorKeyVal As Color = Color.FromArgb(255, 0, 255, 0) 'LimeGreen SpriteImage = TextureLoader.FromFile(dxDevice, ImageName, _32, 32, D3DX.Default, 0, Format.Unknown, Pool.Default, Filter.Point, Filter.Point, ColorKeyVal.ToArgb) I think you'd have to use the ARGB values. -The Pentium Guy
  12. Turn off lighting: D3DDev.Renderstate.Lighting = False... If this doesn't work, paste your GameClass here :p. Heh, your gameclass + your Sprite class (whcih you've already pasted) are the majority of your project :P so if you post the gameclass maybe we'll see whats up. Could you clearly explain whats going on? Is it just not showing the sprite? -The Pentium Guy
  13. The last argument shouild be > 0 I think. If it was 0, you're "Cutting off" all the objects with a Z which have greater than 0 and less than... 0 ;). Put like... 5 or somethign for the last argument, it really doesn't matter :-P.
  14. its VIEW not projection :). Projection is used for 3d to tell the device how the scene should be displayed (like, should you see 45 degrees of the screen, should you see 90 degrees.., aspect ration....etc)
  15. What matrices have you set? Be sure to set them right - on my tutorials i've set the View Matrix to OrthoOffCenterLH(0,1024,768,0)
  16. In vs.net look in Help | About.
  17. Hehe! that's the probelem with having a free site ;). This can be accomplished easily. Lets say the dude is on tile 20,20, and the size of each tile is 30x30. This means that he's on tile 0,0 - if he's on 50,50, he's on tile 1,1.. The algorithm to compute his position is pretty basic and you can figure it out when you plug in numbers: TilePos = new Point( Math.Floor(Position.X / tileWidth), Math.Floor(Position.Y / tileHeight) Floor, btw, rounds DOWN. So, e.g back to the 20,20 example: 20/30, 20/30 = .666,.666 .. math.Floor would round it to 0,0 as opposed to 1,1. That's the algorithm to compute the tile he's on. To move him, you simply eliminate the loop and use the same collision detection algorithm - with a few tweaks of course.. for example if the guy is at 40,40 and wants to go to tile 0,0. After he gets to 29,29 he cannot move left anymore [ if you've set it so that he can't go to the left of 0,0] becuase 29/30, 29/30 -> 0,0 and if you want to compute collision for the tile to the LEFT of 0,0 (whcih is -1,0) it says "No" becuase that's not possible, and it wont let you move further left!... this requires a few tweaks like I said Heh - .. did you render the sprite? :)
  18. Strange.. are you using .net 2003? it works on my 2003 but not 2002.
  19. heh, btw2: www.vbprogramming.8k.com - look in the Tile Based Collision Detection tutorials (its with GDI+ but you should be able to apply the concept to d3d) Here's what I did in my game: for example you have this: MapTiles(3,2) = 1 You'd simply create a tile at (3,2) which uses 1.jpg.. mine works like: for x = 0 to mapwidth for y = 0 to mapheight CreateATile( maptiles(x,y) & ".jpg", x*tileWidth, y *tileHeight) next next Where the first argument is what bitmap is displayed where the 2nd and 3rd arguments are the posijtion of the tile. Ex: If x was 3, and y was 2.. "MapTiles(3,2) = 1" and tilewidthwas 30 and tileHeight was 30: then the compiler would read it as CreateATile("1.jpg", 90, 60) The whole x*tilewidh, y*tileheight concept is simple - if you don't understand it i think i included some explanation in my tutorial -The Pentium Guy
  20. Heh, yeah they're mainly C++ people ;), and half the time when you make a post, about 300 other people make a post right after you and your post is like in the 10th page :). The GOOD thing about that site is if someone does end up reading it, you'll get an answer within seconds - there are thousands of people at that site all the time. -The Pentium Guy
  21. Heh, I guess i'm damn lucky that was an old machine :). I just reinatalled XP ;).
  22. Heh. I've got some answers: 1) I use the same format too, but u should do 1 thing: Seperate each entry with columns. 2) I have my own sprite class, and each tile is a sprite - so i use a vertex buffer for each tile, im not sure if this is memory efficient or not - but 1 vertex buffer can only hold so many vertices. 3) -Whats the best way to display maps?? Store all the tiles into 1 map array and in a loop render all the tiles -When the player moves around, should i move the map or the camera and player? Have you done transformations yet? You should move the map :). In my game, I keep the player stays centered on the screen. So I never move his position. 4) Again, I made my own sprite class - each of my players/objects/WHATEVER go in their own seperate vertex buffer. I don't think (although im not sure) that when you have multiple objects in 1 vertex buffer, you can rotate them individually. So I stored them in different vertex buffers. -The Pentium Guy
  23. Hey guys, I was going to set up a LAMP server (to turn my PC into a linux server, but make it dual boot so to still have windows on it) My friend gave me this proggie called Partition Magic so that i can resize my windows partition. There was 8 gb left, and i made 6 gb of room for my linux partition. It told me to reboot to start. So it went into dos mode atuomatically and started partitioning..etc. *sighs* next it gave me an error message: Batch Error. Please press any key to reboot. so i thought it would fix it after the next reboot so i hit a key. When i restarted - the WindowsXP loading screen came up, and when taht finished loading - the stupid thing gave a blue screen (for less than a millisecond so i couldn't read it) and restarted. I tried safe mode, i tried Normal mode, i tried Last known good confguration.. NOTHING WORKED! it just keeps restarting. Please keep in mind tha ti want both windows and linux on the computer and i want my files "Safe" is there anything i can do? - The Pentium Guy
  24. Ah crap. Forums messed up my code again (squished the blue words together). Yo Xebec - how'd you get your code to appear in "Black And White".. i used [ code ] tags.. it appears in color and double spaces and squishes 'em together.
  25. DirectX 9.0c requires you to use a sprite argument. MY class looks something like this [size=2][color=#0000ff]Public[/color][/size][size=2] [/size][size=2][color=#0000ff]Class[/color][/size][size=2] clsText [/size][size=2][color=#0000ff]Dim[/color][/size][size=2] TheFont [/size][size=2][color=#0000ff]As[/color][/size][size=2] Microsoft.DirectX.Direct3D.Font = [/size][size=2][color=#0000ff]Nothing [/color][/size][size=2][/size][size=2][color=#0000ff]Dim[/color][/size][size=2] rect [/size][size=2][color=#0000ff]As[/color][/size][size=2] [/size][size=2][color=#0000ff]New[/color][/size][size=2] Rectangle(0, 0, 0, 0) [/size][size=2][color=#0000ff]Dim[/color][/size][size=2] x [/size][size=2][color=#0000ff]As[/color][/size][size=2] Microsoft.DirectX.Vector3 [/size][size=2][color=#0000ff]Dim[/color][/size][size=2] y [/size][size=2][color=#0000ff]As[/color][/size][size=2] Microsoft.DirectX.Vector3 [/size][size=2][color=#0000ff]Dim[/color][/size][size=2] s [/size][size=2][color=#0000ff]As[/color][/size][size=2] Microsoft.DirectX.Direct3D.Sprite [/size][size=2][color=#0000ff]Public[/color][/size][size=2] [/size][size=2][color=#0000ff]Sub[/color][/size][size=2] [/size][size=2][color=#0000ff]New[/color][/size][size=2]([/size][size=2][color=#0000ff]ByVal[/color][/size][size=2] d3ddev [/size][size=2][color=#0000ff]As[/color][/size][size=2] Microsoft.DirectX.Direct3D.Device, [/size][size=2][color=#0000ff]Optional[/color][/size][size=2] [/size][size=2][color=#0000ff]ByVal[/color][/size][size=2] fontname [/size][size=2][color=#0000ff]As[/color][/size][size=2] [/size][size=2][color=#0000ff]String[/color][/size][size=2] = "Courier", [/size][size=2][color=#0000ff]Optional[/color][/size][size=2] [/size][size=2][color=#0000ff]ByVal[/color][/size][size=2] Size [/size][size=2][color=#0000ff]As[/color][/size][size=2] [/size][size=2][color=#0000ff]Integer[/color][/size][size=2] = 10) TheFont = [/size][size=2][color=#0000ff]New[/color][/size][size=2] Microsoft.DirectX.Direct3D.Font(d3ddev, [/size][size=2][color=#0000ff]New[/color][/size][size=2] System.Drawing.Font(fontname, Size)) s = [/size][size=2][color=#0000ff]New[/color][/size][size=2] Microsoft.DirectX.Direct3D.Sprite(d3ddev) [/size][size=2][color=#0000ff]End[/color][/size][size=2] [/size][size=2][color=#0000ff]Sub [/color][/size][size=2][/size][size=2][color=#0000ff]Public[/color][/size][size=2] [/size][size=2][color=#0000ff]Sub[/color][/size][size=2] Drawtext([/size][size=2][color=#0000ff]ByVal[/color][/size][size=2] text [/size][size=2][color=#0000ff]As[/color][/size][size=2] [/size][size=2][color=#0000ff]String[/color][/size][size=2], [/size][size=2][color=#0000ff]ByVal[/color][/size][size=2] cColor [/size][size=2][color=#0000ff]As[/color][/size][size=2] System.Drawing.Color) [/size][size=2]s.Begin(Microsoft.DirectX.Direct3D.SpriteFlags.AlphaBlend)[/size] [size=2]TheFont.DrawText(s, text, 0, 0, cColor) s.End() [/size][size=2][color=#0000ff]End[/color][/size][size=2] [/size][size=2][color=#0000ff]Sub[/color][/size] [size=2][color=#0000ff]End[/color][/size][size=2] [/size][size=2][color=#0000ff]Class[/color][/size] [size=2][color=#0000ff] [/color][/size]
×
×
  • Create New...