• Advertisement

Android07

Member
  • Content count

    29
  • Joined

  • Last visited

Community Reputation

122 Neutral

About Android07

  • Rank
    Member
  1. I am making a tile based platformer and am having some problems with my collision detection/response. Currently I am checking which tiles the player is in and then checking each to see if that tile can be collided with. This part of my code works perfectly, I think the problem is in how I handle the collision. I look at the direction that the player is moving in and move them back outside of the tile. This works in most cases except where the player is moving in both x and y because when pushing against a wall to the left it will detect they are inside of a tile and move them up and right outside of the tile rather than just right. I can't find any method of working out way to move the player that works in all scenarios. Any help would be appreciated. Thanks.
  2. 3DS model reader

    Do I need to have average normals for each vertex or could I just use the facet normal? Also I think the reason it was exporting 32 vertices was that there was also 32 texture coordinates.
  3. 3DS model reader

    I have written a 3DS model reader. While it works fine and draws my models I am having problems calculating normals for each vertex. I understand that I need a normal for each vertex that is an average of all the facet normals around it. The problem is that 3DS Max 2009 exports 32 vertices for a 1x1x1 cube with only 1 segment each side. It seems that it is exporting 3 vertices for each facet, e.g. rather than having vertex 0 in facet 0, 4 and 5, it will export the same vertex 3 times for the 3 different facets. The reason that this is a problem is that I can't keep track of the number of connections at each vertex without checking every single vertex every to see if they are the same. //Done for each facet connections[facet[i][0]]++; connections[facet[i][1]]++; connections[facet[i][2]]++; *normals[facet[i][0]] += *meshFacet[i]->normal; *normals[facet[i][1]] += *meshFacet[i]->normal; *normals[facet[i][2]] += *meshFacet[i]->normal; for (int i=0; i<vertexCount; i++) { *normals[i] /= connections[i]; } Is what I have at the moment but each vertex has only 1 connection rather than 3 or 4 like it should have. Is this some setting in Max for the exporter or am I going to have to change the code? Thanks.
  4. Parallax techniques

    Thanks for that, I was hoping to be able to achieve the effect in 2D, similar to F-Zero.
  5. Parallax techniques

    Hopefully this image will explain what I am trying to do better. I want tile an image like it vertically so that as the player continues moving forwards, everything else in the world moves down and gets bigger. The main problem that I am having is that my tiles don't line up correctly or scale correctly as they move.
  6. I'm not sure if this would be the same as parallax scrolling but I can't find anything that could help. I'm trying to make a 2D game where you move into the world, so as you move forwards the smaller objects at the top of the screen get bigger and lower as they get closer. I have a simple prototype to try and get the scale right with just a floor that is moving down. My floor image is tiled and its X scale is set based on it's Y position. 0 is scale 1, anything higher is smaller and lower is higher for example -600 is 0.25 and 600 is 4. While this is correct at those points for everything inbetween the tiles don't match up and the edges of the floor that should be moving through the bottom corners of the screen, move up the sides and then down again. I hope that I have explained that properly but if anyone could point me in the right direction I would be grateful. Thanks.
  7. Can't delete

    It is for banking application, I just tried a virtual destructor and it works now. Thanks for the help. I have never seen anywhere that you should have a virtual destructor for class with virtual functions so I never thought to do that. Thanks again.
  8. Can't delete

    Yes, that fails, and no. Product doesn't have a virtual constructor.
  9. Can't delete

    I'm having some problems with the destructors for my program. I have a Product class that has several different class inheriting from it. These all get destructed fine when they should except for object of one particular type that inherits from Product. When it should be deleted I get an assertion failure at the line _ASSERTE(_BLOCK_TYPE_IS_VALID(pHead->nBlockUse)); in dbgdel.cpp The object is of type CreditCard that also inherits from Card. Neither Card or CreditCard has a destructor as they don't allocate any resources, only the Product class. I don't know if the multiple inheritance has anything to do with this as I have never used it before. Product *cc = new CreditCard(); delete cc; causes the error but CreditCard *cc = new CreditCard(); delete cc; works fine. Is there anyway that I can fix this or am I going to have to cast by Product pointer to a CreditCard pointer before I can delete it? Thanks.
  10. Simple c++ question

    Thanks everyone, but it's working again now, I didn't have string.h included only iostream.h. I didn't think that I needed to include both as the string type was recognised. Thanks again.
  11. Simple c++ question

    I'm having a problem using cin. The code used to work perfectly but know it doesn't. string name; cout << "Please enter name: "; cin >> name; When compiling I get error C2679: binary '>>' : no operator found which takes a right-hand operand of type 'std::string' (or there is no acceptable conversion) This error started when I tried to overload the << operator to use one of my own classes with cout but I didn't touch this piece of code and have now commented this out in case it would cause any problems but it still doesn't work. I am including iostream and have using namespace std;
  12. Trouble with Matrix4x4 class

    Thanks. I compared what you had to my code and found a few small errors. It seems to be working now.
  13. Trouble with Matrix4x4 class

    I'm trying to write a class for a 4x4 Matrix to use for transformations. I also have a Vector3 class and have written a method to multiply a vector by a matrix. I know that technically I need a 4D matrix of x,y,z,1. This all works fine for rotation and scaling, however when I move onto translation it doesn't seem to work, if I translate the vector 1,0,0 by 1,1,1 the result is 2,0,0. I have seen some places say that the translation should be in the bottom row others say the right column. Which should it be? Previously I used opengl to store calculate the matrix and then stored in a float array so I never had to worry about all this. Can someone help me with this, or point me to somewhere that can? Thanks.
  14. OpenGL Limiting update rate

    I've done some playing and I seem to have Servant of the Lord's method C working. The logic is updating at 60 fps while the game is rendering as fast as it can. There isn't much in there yet so on my main PC that's over 1000fps. Thanks for all your help everyone.
  15. OpenGL Limiting update rate

    Thanks for your help everyone, I haven't tried it yet but I didn't know about the GetTickCount function so that will help. Will play around with it tomorrow but I think I understand how to get this working. Thanks again.
  • Advertisement