Tag Info

New answers tagged

3

This line: int num = TileNode z; You are declaring a TileNode with symbol z, but you are assigning that to an int. You can't assign a symbol declaration under any circumstances, so the compiler is yelling at you for it. It also doesn't make any sense; you probably want to assign that int to some property of z, right? This is doubly wrong because you ...


0

Give your tank a Property that Tracks where its Bounds are. Give all other objects a Bounds as well. Check against the two rectangles to see if they are binding. Rectangle rect1 = new Rectangle(x,y,width,height); Rectangle rect2 = new Rectangle(x,y,width,height); x and y would be your sprites location in the world (Vector2.X and Vector2.Y) Width and ...


0

If you have uncapped FPS, it should eat 100% of your CPU, but most probably you want cap FPS at some reasonable value, say 60 fps, basic implementation can be as follows: const unsigned int FPS = 60; const unsigned int DELAY_TIME = 1000 / FPS; unsigned int frameStart, frameTime; int spareTime; // your main loop while (bRunning) { frameStart = ...


0

Your answer to the collision problem is true/false. Instead you can differentiate between no collision, penetration of the object and touching the object. Then only disallow movement in the case of penetration, but allow touching. I'd also suggest you move the collision code out of your tank and GameObject. Tanks and GameObjects both really just contain a ...



Top 50 recent answers are included