Advertisement Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Community Reputation

100 Neutral

About PCosmin89

  • Rank
  1. PCosmin89

    ArcTg based movement problem in XNA

    Thank you, I still went with the ATan2 approach with a simplified code and it works.
  2. Greetings, My application has two sprites, a player-controlled ship and an asteroid that 'should' go towards the ship. private void moveTowards(GameTime gameTime, Sprite source, Sprite destination) { Random rand = new Random(); float timeLapse = (float)gameTime.ElapsedGameTime.Milliseconds; float movementPath = (float)Math.Atan2(source.getPosition().Y - destination.getPosition().Y, source.getPosition().X - destination.getPosition().X); movementPath += ((float)rand.NextDouble() - 0.5f) * (float)rand.NextDouble(); if (source.getPosition().Y - destination.getPosition().Y < 0) movementPath += (float)Math.PI; source.setPosition(new Vector2(source.getPosition().X + (float)Math.Cos(movementPath), source.getPosition().Y + (float)Math.Sin(movementPath))); } This would be the function I use to compute the next position of the Source sprite ( asteroid in our case ). The problem I'm getting is that if I pass the sprite's 0X line ( that is asteroid's Y == ship's Y from what I can tell ), the asteroid changes direction ( opposite ). Anyone have any experience with this problem ? Thank you
  3. PCosmin89

    Web hosters

    Quote:Original post by Concentrate I am learning html and css, right now, and would like to practice as I go along. I was thinking about having a website, that shows off my graphics programming stuff, and maybe that posts tutorials, or something todo with programming stuff. Maybe even a forumn. If you are just learning the basics of web development I suggest using WAMP to host your own content. As for the website, before you can make a nice one, you should just go along with a blog ( you can get one from Wordpress or Blogger - though I recommend wordpress ). Just my two cents, best of luck ( also, WAMP will be all you would need until you start with more advanced web development )
  4. PCosmin89

    How to get UDP broadcast packets

    Wouldn't opening a socket connection work for intercepting those ports ?
  5. PCosmin89

    Making Asteroids in Java

    Instead of using your keys to add movement to your ship, try to use a system closer to how real life works. Instead of incrementing your position by x at each keystroke, use a system based on Velocity and Acceleration. This should give you all the information you need on connecting those elements and making a fluid movement.
  6. PCosmin89

    pseudocode to c++

    I will not convert that for you, that would be bad as you would not understand the ( probable ) assignment. Instead I will try to tell you how bits should be done: Reading is done through cin >> variable; To dynamically allocate space for n sized variables you must first declare a pointer and afterward use the new operator to accomplish that. Ex. int *variable = new int[value]; I hope you understand the loops by now so I don't have to write them, good luck and you should really try understanding them !
  7. PCosmin89


    Quote:Original post by Machaira the words "basic", "3D", and "RPG" contradict one another. :) There's nothing "basic" about a 3D RPG. Try something easier. Nah, but he could give a MMORPG a try, I heard they were pretty basic :D
  8. PCosmin89

    Quick and dirty vga programming

    Well my first advice would be drop Bloodshed Dev-C++ for Windows as it's no longer supported properly, you might want to have a look at Microsoft Visual C++ Express Edition. As for VGA advice, I'll let someone who knows what he's talking about give the advice here :) Best of luck
  9. PCosmin89

    Say hi to the new guy

    Greetings, if you know Visual Basic it's a start. While the Game Dev's industry standard is still ( correct me if I am wrong ) C++, many people here suggest starting with C# as it is a nice language, once you learn the basics, grab a hold of Microsoft's XNA Engine ( a simple google search will reveal the details ). Best of luck to you.
  10. PCosmin89

    XML variable ?

    Thanks, I tried google but I had no idea on what I should search, attributes worked fine, thank you
  11. PCosmin89

    XML variable ?

    Greetings everyone, I come yet again with a problem, a noob question to be honest. I'm using C# to get data from an XML table, I managed to get what I need except for Quote:<registered unixtime="1037793040">2002-11-20 11:50</registered> I need to get unixtime, anyone have any ideas on how I get it ? In case it matters, this is the method I am using to get other fields: while (userReader.Read()) { if (userReader.NodeType == XmlNodeType.Element && userReader.Name == "name") while (userReader.Read()) if (userReader.NodeType == XmlNodeType.Text) { totalMembrii++; numeUser = Convert.ToString(userReader.Value); break; } if (userReader.NodeType == XmlNodeType.Element && userReader.Name == "playcount") while (userReader.Read()) if (userReader.NodeType == XmlNodeType.Text) { totalMelodii += Convert.ToInt32(userReader.Value); playCount = Convert.ToInt32(userReader.Value); break; } }
  12. Try using a model loader for more complex shapes, hard-coding all this vertex-date is a pain...
  13. PCosmin89

    [ Help ] Heap error due to delete []

    Thank you for the fast replies guys, barely had time to take a shower :) I see my mistake now, thanks Palidine for explaining! Quote:Original post by Palidine But really you should be using std::string since you're using C++ Quote:Original post by _fastcall Also, if you want to do anything with strings, do as older1s says and use std::string. Thank you for your inputs, I use strings in what I do for myself, unfortunately this is for a school project in which char* is supposed to be used, thus I am stuck with this for now. Thanks again
  14. Greetings, I would greatly appreciate it if you guys could help me find the fault in my logic, I have been looking at this piece of code for some time now and I can't figure out what I'm doing wrong. I believe this is the code needed to see what is wrong: // Default constructor for a carte class carte::carte() { titlu = new char[10]; titlu = "NeInit"; autor = new char[10]; autor = "NeInit"; pret = 0; } // Function to set all parameters ( for loop declarations ) void carte::set_all() { // Deleting these so I won't have any problem overwriting. // I tried without the deletes and it worked but I will // probably come across some problems later on delete [] titlu; // This is where the program breaks delete [] autor; // I presume it would break here too char *t = new char[31]; char *a = new char[31]; cout << "Titlu: "; cin.getline(t, 30); cout << "Autor: "; cin.getline(a, 30); cout << "Pret: "; cin >> pret; titlu = new char[strlen(t)+1]; autor = new char[strlen(a)+1]; strcpy(titlu, t); strcpy(autor, a); delete [] t; delete [] a; } In the main body of the function, I have something like: carte test; test.set_all(); // This is pretty much where it breaks Also, if anyone has the time/mood to look ( perhaps I'm wrong and the problem is elsewhere ), you can find the ( almost :P ) complete code here. Thanks, Parvulescu Cosmin
  15. Greetings yet again, I just finished implementing Perlin Noise ( Hugo Elias one ), and forgive me if I understood it's coding wrong, but I get similar results to him. My problem is trying to make a moving grayscale-noisemap, let's say clouds, what I do not understand is, on a 6 octave noise and on a 800x600 resolution it would need 800x600x6 runs just to fill the screen once. Is that correct ? Can anyone suggest another way of implementing this noise in SDL ? This is my current function: [source lang = "cpp"] void drawNoise(float pers, int oct, float zoom) { for (int i = 0; i < 640; i++) for(int j = 0; j < 480; j++) { int pos = j * (screen->pitch / 4) + i; float xD = perlin2D(j, i, pers, oct, zoom) * 128 + 128; Uint32 color = SDL_MapRGB(screen->format, xD, xD, xD); ((unsigned int*)screen->pixels)[pos] = color; } }
  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!