Jump to content
Xtreme .Net Talk

Himo

Avatar/Signature
  • Posts

    61
  • Joined

  • Last visited

Everything posted by Himo

  1. I did it! I have created life from nought! In normal terms, I finally got it to work. Thanks for all your tips, iceplug. For all you guys around, I attached my sample project for all to see and learn from. Note to the mods: There's still a /bin/debug directory there because there are some picture files in it. I was to lazy to check for the actual program directory when loading the pictures, so this has to do. ;) pinball.zip
  2. Okay, but what values does the program expect?
  3. That's why I said 'might'. Not in Longhorn, but in the version thereafter, they might have a complete new system for API, INI and offcourse the registry. The registry is just one big mess and they for sure will remove it. No biggie here. The Api code from VB 6 must already be converted because it expects pointers and 32-bit values. Maybe the new versions of Visual .net will only support 64-bit kernel commands. And ini should be replaced by XML, but that's personal.
  4. Yup, I'm a slob too. If not asked for, I don't comment most of my code and the IDE luckily does the indentation for me, because I won't :rolleyes:
  5. You can post any game issue in the .net General forum and for tutorials on GDI+/DirectX and stuff I always go by http://www.gamedev.net. There was a discussion about this but there was too little interest to warrant a gaming forum. That's right mods? mods? ;) BTW: My minesweeper game is hanging around in the random thought forum and my "Creating a pinball game"-thread is in the .Net General forum.
  6. Okay, I didn't know this either, but I looked on google for ToolTip code and I found adding tooltips are ridiciously easy :D Dim toolTip1 As New System.Windows.Forms.ToolTip ' Set up the delays for the ToolTip. toolTip1.AutoPopDelay = 5000 toolTip1.InitialDelay = 1000 toolTip1.ReshowDelay = 500 ' Force the ToolTip text to be displayed whether or not the form is active. toolTip1.ShowAlways = True ' Set up the ToolTip text for the Button and Checkbox. toolTip1.SetToolTip(Me.Button1, "My button1") toolTip1.SetToolTip(Me.TextBox1, "My checkBox1")
  7. Hmm, yes, good old Ini's. But remember, that's legacy programming(API use) so it might not work in future versions of .NET/Windows
  8. About the amount tendered: I'm not really into the American Tax system(I'm still in college, so I even don't have to pay Dutch taxes :D ), so I wouldn't know what it means, if you could explain that somewhere, it would be allright, because my vocabulary doesn't give anything useful except for the translation of 'tender', which you don't mean.
  9. Okay, I've implemented the gravity in the example, but now when I hit the sample bumper, my collision detection goes wacky and my gravity is reversed. :confused: How can I adjust the gravitational force correct when hitting an object? It works on walls... My gravity mechanism is a variable that is decremented each time the movement is calculated when more then 0, the ball goes up, when less then 0 then ball goes down. When hitting the bottom, it's 'energy' is refueled. public void mover_Tick(object sender, System.EventArgs e) { //double Fres = ((0.50 * Math.Pow(speed,2))-(((this.Height-pc.Top)/20.00)*g)); pc.Top+=(int)(vspeed * (gforce / (Convert.ToDouble(multiplier)*speed))); pc.Left+=(int)(hspeed * Math.Tan(radians)); if((pc.Top<=0))//Top vspeed=(-vspeed); if((pc.Top + pc.Height + this.Top)>=this.Bounds.Bottom)//Bottom { vspeed=(-vspeed); gforce = speed * multiplier; pc.Top=this.Height - pc.Height; } if((pc.Left<=0))//Left hspeed=(-hspeed); if((pc.Left + pc.Width + this.Left)>=this.Bounds.Right)//Right hspeed=(-hspeed); gforce-=speed; if(pc.Bounds.IntersectsWith(objects[0].Bounds)) { Random temp = new Random(); if(pc.Bounds.Left<=objects[0].Bounds.Right) { hspeed=(-hspeed); angle+=temp.Next(-10,10); radians = angle * (Math.PI/180); pc.Top-=vspeed; pc.Left+=(int)(hspeed * Math.Tan(radians)); } if(pc.Bounds.Right>=objects[0].Bounds.Left) { vspeed=(-vspeed); angle+=temp.Next(-10,10); radians = angle * (Math.PI/180); pc.Top-=(int)(vspeed * (gforce / (Convert.ToDouble(multiplier)*speed))); } } if(pc.Bounds.IntersectsWith(objects[0].Bounds)) { Random temp = new Random(); if(pc.Bounds.Bottom>=objects[0].Bounds.Top) { vspeed=(-vspeed); angle+=temp.Next(-10,10); radians = angle * (Math.PI/180); } if(pc.Bounds.Top<=objects[0].Bounds.Bottom) { vspeed=(-vspeed); angle+=temp.Next(-10,10); radians = angle * (Math.PI/180); pc.Top-=(int)(vspeed * (gforce / (Convert.ToDouble(multiplier)*speed))); } } }
  10. There we go: On the setup: - In the standard version of the setup it still demands the .Net setup, due to a wrong value in the ini file(BootStrapFx=true) - In the end you get a textbox with "Setup completed succesfully". Isn't that a bit double on? I mean, the setup says that it is completed by itself in the end. If this is standard, don't mind it then, but I think not. On the program: - I think the yellow buttons are annoying - You shouldn't be obliged to read the manual to know you must type in Admin/Admin the first time. - The "log out" button doesn't do anything :? - In the search for products, you should clearly state that you are expecting product ids. - The checkout is a little bit confusing to me. As a dutchman, "amount tendered" doesn't say anything to me, so I typed in 2, 1 and 3%, but they all gave errors(non-fatal that is, but with a ugly .net-error box). - When add catergories and departments you can only close the form by clicking "Cancel". I would rename it to "Close", that's more comforting ;) On the manual: - The quality of the screenshots is a bit too blurry. Maybe you could use TIFF? (or BMP for that matter) - The font size could be a little bit smaller. Good manual though. Very clear. Misc.: - The access database you're using isn't secured. This means I can open it with access and scramble it, rendering your program useless. I think you might wanna put a password on it. That'll be it for now. :D
  11. Yup, sending you feedback asap.
  12. Why use Goto in the first place? We're in the age of OO programming :rolleyes: Goto is bad programming and makes your code less readable, don't use it. I think this could be a OO solution(My VB might be incorrect) Dim Questions() As String(5) Dim Answers() As String(5) Dim NpcAnswers() As String(5) Public Sub Main(Blah) Questions(0) = New String("Want some money?") Answers(0) = New String("2/Yes/No") NpcAnswers(0) = New String("2/Fine, leave it that way then./Okay, here you have some.") Conversation(Questions, Answers, NpcAnswers) End Sub Public Sub Conversations(Questions() As String, Answers() As String, NpcAnswers() as String) Dim index As Short Dim x As Short Dim answercode As Short Dim temp() As String For index = 0 To questions.Size 'Or whatever //Display question(index) temp = Answers.Split("/") For x = 0 To temp.Size //Display x: Answers(index) Next x answercode = Convert.ToInt16(Reader.readline()) //Display NpcAnswer(answercode) Next index End Sub A lot more civil I think so.
  13. Well, I'll assume everyone is happy about this one :D
  14. What about Vectors? They're in Java.Util.Vector (I think, has been a while) and functions like dynamic uber-arrays. They have a InsertAt/RemoveAt function and a can contain everything, thanks to explicit casting, I love it. Just an extension.
  15. *Bounces off chair So you say, my formula is essentially worthless? :p Damn, anymore tips before I start coding another stupid formula? (I'm trying this while highschool proved an physics average of D+(5 out 10)) Edit: When testing my speed remains the same, but the object seems to go faster anyways. Does this has something to do with the angle? How can this be prevented?
  16. An update on my function, now trying to incorporate gravity. This goes horribly wrong, but this way you can take a look at my thoughts. Edit: Did the seperate axis collission detection, but now I don't know anymore which axis I have to invert what for. :o Btw: Is it practical to have a vertical and horizontal speed? On gamedev.net hey said no, but I see no other option, because my collision detection is dependant on it. public void mover_Tick(object sender, System.EventArgs e) { double Fres = ((0.50 * Math.Pow(speed,2))-(((this.Height-pc.Top)/20.00)*g)); if(Fres<0) vspeed = (-(int)Math.Sqrt(2*(-Fres))); else vspeed = (int)Math.Sqrt(2*Fres); hspeed=(int)(vspeed * Math.Cos(radians)); if((pc.Top<=0))//Top vspeed=(-vspeed); if((pc.Top + pc.Height + this.Top)>=(this.Bounds.Bottom))//Bottom vspeed=(-vspeed); if((pc.Left<=0))//Left hspeed=(-hspeed); if((pc.Left + pc.Width + this.Left)>=(this.Bounds.Right))//Right hspeed=(-hspeed); pc.Top-=vspeed; pc.Left-=hspeed; if(pc.Bounds.IntersectsWith(objects[0].Bounds)) { Random temp = new Random(); if(pc.Bounds.Bottom>objects[0].Bounds.Top) { vspeed=(-vspeed); angle+=temp.Next(-10,10); radians = angle * (Math.PI/180); } if(pc.Bounds.Top<objects[0].Bounds.Bottom) { vspeed=(-vspeed); angle+=temp.Next(-10,10); radians = angle * (Math.PI/180); } Fres = ((0.50 * Math.Pow(speed,2))-(((this.Height-pc.Top)/20.00)*g)); if(Fres<0) vspeed = (-(int)Math.Sqrt(2*(-Fres))); else vspeed = (int)Math.Sqrt(2*Fres); pc.Top+=vspeed; } if(pc.Bounds.IntersectsWith(objects[0].Bounds)) { Random temp = new Random(); if(pc.Bounds.Left<objects[0].Bounds.Right) { hspeed=(-hspeed); angle+=temp.Next(-10,10); radians = angle * (Math.PI/180); pc.Top-=vspeed; } if(pc.Bounds.Right>objects[0].Bounds.Left) { vspeed=(-vspeed); angle+=temp.Next(-10,10); radians = angle * (Math.PI/180); pc.Top-=vspeed; } Fres = ((0.50 * Math.Pow(speed,2))-(((this.Height-pc.Top)/20.00)*g)); if(Fres<0) hspeed = (-(int)Math.Sqrt(2*(-Fres)* Math.Cos(radians))); else hspeed = (int)(Math.Sqrt(2*Fres) * Math.Cos(radians)); pc.Left+=hspeed; } }
  17. And this compiles? I'm more into C#, but when using a setter for a property I always use the 'value' variable supplied by the C# language, so I don't need any 'ByVal var' at the setter code. Have you tried the sister site of this site yet? http://www.xtremevbtalk.com ? They're much more into vb .net then this site :)
  18. And what about integrating downfall gravity? I think it should be something like this: Fres = (Fup - Fg) * tan(angle) Fres = 1/2*v^2 v = Math.Sqrt(2*Fres) Where Fres is the resulting power vector you get when substracting the gravitational force from the upgoing force.(As in Fup = 1/2*v^2 and Fg = g*height, because mass is static I left it out) I'm I somewhere right?
  19. It's funny for us, but not for the webserver. Poor thing, let's raise a funds for him to retire and be put in an orphanage to have games to serve for children :)
  20. But declaring Array[1024] gives an array of 1024 elements. 0 to 1023.
  21. There's no ; behind the last argument in a for loop. And you're sure that this class also exists in Java(not sure if this is a custom or VB .net class) Some mistakes though: ClassEnc6[] NewEnc = new ClassEnc6[1024]; for(int num = 0; num < NewEnc.Length; num++) //Arrays begin at index 0 { NewEnc[num] = new ClassEnc6("encryptionkey"); } And I would recommend JBuilder Personal from borland as it is free. :)
  22. Hi, I'm making this pinball game, just to further hone my gamemaking skills. I'm first trying to figure out how things like bouncing works. I got this form with one object on it(An Image) and the ball(PC(Player Character). I'm trying to let the ball bounce of the image at an angle, but this only works with the form. It just passes through the Image(Slightly changing it's angle) and doesn't arc of in the opposite way like he does when colliding with the form. Below I posted my phsyics piece. Thanks for your help :) Notes: Objects[] is an PictureBox array that holds all the object that are on the table(like bumps and blackholes) vspeed is the vertical speed hspeed is the horizontal speed pc is the ball(a PictureBox) angle is the angle in degrees radians is that translated into radians public void mover_Tick(object sender, System.EventArgs e) { pc.Top+=vspeed; pc.Left+=(int)(hspeed*Math.Tan(radians)); if((pc.Top<=0))//Top vspeed=(-vspeed); if((pc.Top + pc.Height + this.Top)>=(this.Bounds.Bottom))//Bottom vspeed=(-vspeed); if((pc.Left<=0))//Left hspeed=(-hspeed); if((pc.Left + pc.Width + this.Left)>=(this.Bounds.Right))//Right hspeed=(-hspeed); if(vspeed>20) vspeed=5; if(vspeed<(-20)) vspeed=(-5); if(hspeed>20) hspeed=5; if(hspeed<(-20)) vspeed=(-5); if(pc.Bounds.IntersectsWith(objects[0].Bounds)) { if(pc.Bounds.Bottom>objects[0].Bounds.Top) { vspeed=(-vspeed); vspeed+=5; angle+=5; radians = angle * (Math.PI/180); } if(pc.Bounds.Top<objects[0].Bounds.Bottom) { vspeed=(-vspeed); vspeed+=5; angle-=15; radians = angle * (Math.PI/180); } if(pc.Bounds.Left<objects[0].Bounds.Right) { hspeed=(-hspeed); hspeed+=5; angle-=20; radians = angle * (Math.PI/180); } if(pc.Bounds.Right>objects[0].Bounds.Left) { hspeed=(-hspeed); hspeed+=5; radians = angle * (Math.PI/180); } } }
  23. Okay, I took all your suggestions in consideration and did this: - Added a timer(With pause function) to show your score - The common variants in a dropdown - If you now click on a tile, it get a "sunken" buttonstyle, so you know which you clicked. - It now offers a play-again option instead of just shutting down. What I didn't find: - I didn't experience lockups, maybe it's fixed now, since it's only loops the tiles' buttonclick event. What I didn't include: - Moving the game mechanic to another class. It's a small game, so not really necessary. - The placing of the bombs after the first click There's on average a 10% chance that this will happen. Well, since your weren't playing that long, you can start over easily without frustration. (Just too lazy :P ) That'll be it. Note: I modded the attachment now, so that it doesn't include any directories anymore. For your comfort PlausibleDamp ;) minesweeper.zip
  24. a .config or .cfg file in .net is XML-based so you can use the System.XML.XmlTextReader to read it out.(But I prefer the XmlDocument with XmlNodeList)
  25. First, thanks, I got bored and never did any game programming, so before moving to tetris, a friend(who has 92 seconds in Expert mode in windows minesweeper) suggested me to make this. I also bugtested with him and found two major errors: - The numbers given in the boxes were blatantly wrong when not playing in a square mode(i.e. 8x8, 5x5) - It didn't support to have an X larger then the Y.(i.e. 10x5, 8x3), so I fixed it. I'll try to add the common game options. Here is the slightly changed version of it. Edit: I do have one question though. My win condition is not what you say, ideal. Does anyone got a better idea that only bombs remain? WithOutExeminesweeper.zip
×
×
  • Create New...