Advertisement Jump to content
  • Advertisement

sidbhati32

Member
  • Content Count

    21
  • Joined

  • Last visited

Community Reputation

102 Neutral

About sidbhati32

  • Rank
    Member

Personal Information

  • Interests
    Programming

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. @_WeirdCat_ Yes, correct. Anyways I thougt of this -> void Game::DoCollision(GameEntity *a, GameEntity *b) { Ship *player = static_cast<Ship *>(a == player_ ? a : (b == player_ ? b : 0)); Bullet *bullet = static_cast<Bullet *>(IsBullet(a) ? a : (IsBullet(b) ? b : 0)); Asteroid *asteroid = static_cast<Asteroid *>(IsAsteroid(a) ? a : (IsAsteroid(b) ? b : 0)); Bullet *bulletMode = static_cast<Bullet *>(IsBulletMode(a) ? a : (IsBulletMode(b) ? b : 0)); if (player && asteroid) { player->playerCollided = true; //AsteroidHit(asteroid); //DeletePlayer(); } if (bullet && asteroid) { if(bullet->bulletCollided == false) { bullet->bulletCollided = true; collidedBullets.push_back(bullet); } if(asteroid->asteroidCollided == false) { asteroid->asteroidCollided = true; collidedAsteroid.push_back(asteroid); } //AsteroidHit(asteroid); //DeleteBullet(); } if(bulletMode && asteroid) { if(bulletMode->bulletCollided == false) { bulletMode->bulletCollided = true; collidedBulletMode.push_back(bulletMode); } if(asteroid->asteroidCollided == false) { asteroid->asteroidCollided = true; collidedAsteroid.push_back(asteroid); } } } Would it work?
  2. Hey, So I have got this asteroid type game and today I encountered a new issue while testing this game. What happened was that two asteroids were close to each other and I shot a bullet at them. The asteroids were so close to each other that a single bullet could collide to both of them. It collided and my game crashed there itself. I figured out it happened because two asteroids and one bullet collided in the same frame. This is the code - ```void Collision::DoCollisions(Game *game) const { for (ColliderList::const_iterator colliderAIt = colliders_.begin(), end = colliders_.end(); colliderAIt != end; ++colliderAIt) { ColliderList::const_iterator colliderBIt = colliderAIt; for (++colliderBIt; colliderBIt != end; ++colliderBIt) { Collider *colliderA = *colliderAIt; Collider *colliderB = *colliderBIt; if (CollisionTest(colliderA, colliderB)) { game->DoCollision(colliderA->entity, colliderB->entity); } } } }``` ``` void Game::DoCollision(GameEntity *a, GameEntity *b) { Ship *player = static_cast<Ship *>(a == player_ ? a : (b == player_ ? b : 0)); Bullet *bullet = static_cast<Bullet *>(IsBullet(a) ? a : (IsBullet(b) ? b : 0)); Asteroid *asteroid = static_cast<Asteroid *>(IsAsteroid(a) ? a : (IsAsteroid(b) ? b : 0)); Bullet *bulletMode = static_cast<Bullet *>(IsBulletMode(a) ? a : (IsBulletMode(b) ? b : 0)); if (player && asteroid) { player->playerCollided = true; //AsteroidHit(asteroid); //DeletePlayer(); } if (bullet && asteroid) { collidedBullets.push_back(bullet); collidedAsteroid.push_back(asteroid); //AsteroidHit(asteroid); //DeleteBullet(); } if(bulletMode && asteroid) { collidedBulletMode.push_back(bulletMode); collidedAsteroid.push_back(asteroid); } }``` ``` void Game::CollisionResponse() { if(player_->playerCollided == true) { DeletePlayer(); } else { if(!collidedAsteroid.empty()) { for(AsteroidList::const_iterator collidedAsteroidIt = collidedAsteroid.begin(), end = collidedAsteroid.end(); collidedAsteroidIt != end ; ++collidedAsteroidIt ) { AsteroidHit(*collidedAsteroidIt); } collidedAsteroid.clear(); } if(!collidedBullets.empty()) { for (BulletList::const_iterator bulletIt = collidedBullets.begin(), end = collidedBullets.end() ; bulletIt!=end; ++bulletIt) { DeleteBullet(*bulletIt); } collidedBullets.clear(); } if(!collidedBulletMode.empty()) { for (BulletList::const_iterator bulletIt = collidedBulletMode.begin(), end = collidedBulletMode.end() ; bulletIt!=end; ++bulletIt) { DeleteBulletMode(*bulletIt); } collidedBulletMode.clear(); } } }``` in my game->docollision() - whenever an asteroid and a bullet used to collide, the collided objects get collected in collidedasteroids and collidedbullets respectively. When two asteroids collided with the same bullet, the two asteroids got collected safely in collidedAsteroid but the single bullet got collected in collidedBullets twice, so when the deletion was happening, the second time iteration of the bullet couldn't find the respective bullet and it got crashed. How am I supposed to approach this problem now? Thanks
  3. @TheComet Oh yes it's of DX structures and z = 0. SO doesn't matter. Cool. Thanks. Anyways which Math.h function should I use? The normal cos and sin?
  4. If I have a velocity vector of (x,y,z) bullet_Velocity.z = tan(player_angle + 45) * bullet_speed?
  5. @TheComet Hey thanks for the reply. What I need is I want to make a shooting mode for my player. It's a 2d asteroid like game and want to shoot three bullets at a time with 45' angle between them. I am using D3DXMath library. So how can I achieve it?
  6. How to calculate angle between two points from a third point with the help of D3DXMATH library?
  7. Aaaye, Thanks Man. I implemented it but again as you said it needs to do some calculations as the player changes its position with time. Anything you had like to suggest me to resolve this?
  8. I just want to shoot towards the enemy so I guess I wouldn't require the distance. I guess I would require the directional vector of my enemy towards the player right? or I would need to do something with the angle?
  9. There are two Entities in the game and we controlling one of them. The other entity moves in a particular direction throughout the game and I want to make the AI like the enemy shoots at my player after some duration of time. I am using Directx 10 SDK for this. I think I would need to calculate the distance between the two entities and shoot it towards the player. I would need to calculate the distance between the two vectors and direction of A towards B. How to calculate the direction between the two?
  10. How do I detect the mouse event of moving my mouse left or right and wheel up or down? I have used Get_X_LParam for mouse movement and WParam for wheel movement. Like DWORD x = HIWORD(wParam) but both of these events return continuous values. for eg. if(x>0) { //do this } else { //do this } the Wparam only returns the same value every time even if I am moving my wheel downwards. Same with Get_X_LParam
  11. sidbhati32

    C++ Game Asteroid

    Yeah it is. Kind of an assignment or a test you can say. But no problem. You can give me hints for doing it either? It will land me a job, that's what I want to say.
  12. sidbhati32

    C++ Game Asteroid

    Hey Alvaro. Thanks for going through the code but this is a test that I have got. I am supposed to find the bugs in this code and something is forcing the build to crash. But I'll honestly let them know a more optimized code for the given. Anyways the main issue is the bug. I have already fixed a few but I can't know what is causing this game to crash Thanks
  13. sidbhati32

    C++ Game Asteroid

    [ #include "Game.h" #include "System.h" #include "OrthoCamera.h" #include "Background.h" #include "Ship.h" #include "Asteroid.h" #include "Explosion.h" #include "Keyboard.h" #include "Random.h" #include "Maths.h" #include "Bullet.h" #include "Collision.h" #include <algorithm> Game::Game() : camera_(0), background_(0), player_(0), collision_(0) { camera_ = new OrthoCamera(); camera_->SetPosition(D3DXVECTOR3(0.0f, 0.0f, 0.0f)); camera_->SetFrustum(800.0f, 600.0f, -100.0f, 100.0f); background_ = new Background(800.0f, 600.0f); collision_ = new Collision(); } Game::~Game() { delete camera_; delete background_; delete player_; DeleteBullet(); DeleteAllAsteroids(); DeleteAllExplosions(); delete collision_; } void Game::Update(System *system) { UpdatePlayer(system); UpdateAsteroids(system); UpdateBullet(system); UpdateCollisions(); } void Game::RenderBackgroundOnly(Graphics *graphics) { camera_->SetAsView(graphics); background_->Render(graphics); } void Game::RenderEverything(Graphics *graphics) { camera_->SetAsView(graphics); background_->Render(graphics); if (player_) { player_->Render(graphics); } for (AsteroidList::const_iterator asteroidIt = asteroids_.begin(), end = asteroids_.end(); asteroidIt != end; ++asteroidIt) { (*asteroidIt)->Render(graphics); } if (bullet_) //**TODO: Candidate for crash { bullet_->Render(graphics); } for (ExplosionList::const_iterator explosionIt = explosions_.begin(), end = explosions_.end(); explosionIt != end; ++explosionIt) { (*explosionIt)->Render(graphics); } } void Game::InitialiseLevel(int numAsteroids) { DeleteAllAsteroids(); DeleteAllExplosions(); SpawnPlayer(); SpawnAsteroids(numAsteroids); } bool Game::IsLevelComplete() const { return (asteroids_.empty() && explosions_.empty()); } bool Game::IsGameOver() const { return (player_ == 0 && explosions_.empty()); } void Game::DoCollision(GameEntity *a, GameEntity *b) { Ship *player = static_cast<Ship *>(a == player_ ? a : (b == player_ ? b : 0)); Bullet *bullet = static_cast<Bullet *>(a == bullet_ ? a : (b == bullet_ ? b : 0)); Asteroid *asteroid = static_cast<Asteroid *>(IsAsteroid(a) ? a : (IsAsteroid(b) ? b : 0)); if (player && asteroid) { AsteroidHit(asteroid); DeletePlayer(); } if (bullet && asteroid) { AsteroidHit(asteroid); DeleteBullet(); } } void Game::SpawnPlayer() { DeletePlayer(); player_ = new Ship(); player_->EnableCollisions(collision_, 10.0f); } void Game::DeletePlayer() { delete player_; player_ = 0; } void Game::UpdatePlayer(System *system) { if (player_ == 0) return; Keyboard *keyboard = system->GetKeyboard(); float acceleration = 0.0f; if (keyboard->IsKeyHeld(VK_UP) || keyboard->IsKeyHeld('W')) { acceleration = 1.0f; } else if (keyboard->IsKeyHeld(VK_DOWN) || keyboard->IsKeyHeld('S')) { acceleration = -1.0f; } float rotation = 0.0f; if (keyboard->IsKeyHeld(VK_RIGHT) || keyboard->IsKeyHeld('D')) { rotation = -1.0f; } else if (keyboard->IsKeyHeld(VK_LEFT) || keyboard->IsKeyHeld('A')) { rotation = 1.0f; } player_->SetControlInput(acceleration, rotation); player_->Update(system); WrapEntity(player_); if (keyboard->IsKeyPressed(VK_SPACE)) { D3DXVECTOR3 playerForward = player_->GetForwardVector(); D3DXVECTOR3 bulletPosition = player_->GetPosition() + playerForward * 10.0f; SpawnBullet(bulletPosition, playerForward); } } void Game::UpdateAsteroids(System *system) { for (AsteroidList::const_iterator asteroidIt = asteroids_.begin(), end = asteroids_.end(); asteroidIt != end; ++asteroidIt) { (*asteroidIt)->Update(system); WrapEntity(*asteroidIt); } } void Game::UpdateBullet(System *system) { if (bullet_) { bullet_->Update(system); WrapEntity(bullet_); } } void Game::WrapEntity(GameEntity *entity) const { D3DXVECTOR3 entityPosition = entity->GetPosition(); entityPosition.x = Maths::WrapModulo(entityPosition.x, -400.0f, 400.0f); entityPosition.y = Maths::WrapModulo(entityPosition.y, -300.0f, 300.0f); entity->SetPosition(entityPosition); } void Game::DeleteAllAsteroids() { for (AsteroidList::const_iterator asteroidIt = asteroids_.begin(), end = asteroids_.end(); asteroidIt != end; ++asteroidIt) { delete (*asteroidIt); } asteroids_.clear(); } void Game::DeleteAllExplosions() { for (ExplosionList::const_iterator explosionIt = explosions_.begin(), end = explosions_.end(); explosionIt != end; ++explosionIt) { delete (*explosionIt); } explosions_.clear(); } void Game::SpawnBullet(const D3DXVECTOR3 &position, const D3DXVECTOR3 &direction) { DeleteBullet(); bullet_ = new Bullet(position, direction); bullet_->EnableCollisions(collision_, 3.0f); } void Game::DeleteBullet() { delete bullet_; bullet_ = 0; } void Game::SpawnAsteroids(int numAsteroids) { float halfWidth = 800.0f * 0.5f; float halfHeight = 600.0f * 0.5f; for (int i = 0; i < numAsteroids; i++) { float x = Random::GetFloat(-halfWidth, halfWidth); float y = Random::GetFloat(-halfHeight, halfHeight); D3DXVECTOR3 position = D3DXVECTOR3(x, y, 0.0f); SpawnAsteroidAt(position, 3); } } void Game::SpawnAsteroidAt(const D3DXVECTOR3 &position, int size) { const float MAX_ASTEROID_SPEED = 1.0f; float angle = Random::GetFloat(Maths::TWO_PI); D3DXMATRIX randomRotation; D3DXMatrixRotationZ(&randomRotation, angle); D3DXVECTOR3 velocity = D3DXVECTOR3(0.0f, Random::GetFloat(MAX_ASTEROID_SPEED), 0.0f); D3DXVec3TransformNormal(&velocity, &velocity, &randomRotation); Asteroid *asteroid = new Asteroid(position, velocity, size); asteroid->EnableCollisions(collision_, size * 5.0f); asteroids_.push_back(asteroid); } bool Game::IsAsteroid(GameEntity *entity) const { return (std::find(asteroids_.begin(), asteroids_.end(), entity) != asteroids_.end()); } void Game::AsteroidHit(Asteroid *asteroid) { int oldSize = asteroid->GetSize(); if (oldSize > 1) { int smallerSize = oldSize -1; D3DXVECTOR3 position = asteroid->GetPosition(); SpawnAsteroidAt(position, smallerSize); SpawnAsteroidAt(position, smallerSize); } DeleteAsteroid(asteroid); } void Game::DeleteAsteroid(Asteroid *asteroid) { asteroids_.remove(asteroid); delete asteroid; } void Game::UpdateCollisions() { collision_->DoCollisions(this); } ] this the code of Game.cpp #include "Bullet.h" #include "Graphics.h" Bullet::Bullet(const D3DXVECTOR3 &position, const D3DXVECTOR3 &direction) { const float BULLET_SPEED = 4.0f; SetPosition(position); D3DXVECTOR3 normalisedDirection; D3DXVec3Normalize(&normalisedDirection, &direction); velocity_ = normalisedDirection * BULLET_SPEED; } void Bullet::Update(System *system) { D3DXVECTOR3 position = GetPosition(); D3DXVec3Add(&position, &position, &velocity_); SetPosition(position); } void Bullet::Render(Graphics *graphics) const { const float RADIUS = 3.0f; struct DummyVert { float x, y, z; D3DCOLOR diffuse; }; DummyVert square[5] = { {-RADIUS, -RADIUS, 0.0f, 0xffffffff}, {-RADIUS, RADIUS, 0.0f, 0xffffffff}, { RADIUS, RADIUS, 0.0f, 0xffffffff}, { RADIUS, -RADIUS, 0.0f, 0xffffffff}, {-RADIUS, -RADIUS, 0.0f, 0xffffffff}, }; D3DXVECTOR3 position = GetPosition(); D3DXMATRIX translationMatrix; D3DXMatrixTranslation(&translationMatrix, position.x, position.y, position.z); D3DXMATRIX identityMatrix; D3DXMatrixIdentity(&identityMatrix); DWORD dummyFvf = D3DFVF_XYZ | D3DFVF_DIFFUSE; graphics->SetVertexFormat(dummyFvf); graphics->DisableLighting(); graphics->SetModelMatrix(&translationMatrix); graphics->DrawImmediate(D3DPT_LINESTRIP, 4, &square[0], sizeof(square[0])); graphics->SetModelMatrix(&identityMatrix); graphics->EnableLighting(); } this is of Bullet.cpp #include "Bullet.h" #include "Graphics.h" Bullet::Bullet(const D3DXVECTOR3 &position, const D3DXVECTOR3 &direction) { const float BULLET_SPEED = 4.0f; SetPosition(position); D3DXVECTOR3 normalisedDirection; D3DXVec3Normalize(&normalisedDirection, &direction); velocity_ = normalisedDirection * BULLET_SPEED; } void Bullet::Update(System *system) { D3DXVECTOR3 position = GetPosition(); D3DXVec3Add(&position, &position, &velocity_); SetPosition(position); } void Bullet::Render(Graphics *graphics) const { const float RADIUS = 3.0f; struct DummyVert { float x, y, z; D3DCOLOR diffuse; }; DummyVert square[5] = { {-RADIUS, -RADIUS, 0.0f, 0xffffffff}, {-RADIUS, RADIUS, 0.0f, 0xffffffff}, { RADIUS, RADIUS, 0.0f, 0xffffffff}, { RADIUS, -RADIUS, 0.0f, 0xffffffff}, {-RADIUS, -RADIUS, 0.0f, 0xffffffff}, }; D3DXVECTOR3 position = GetPosition(); D3DXMATRIX translationMatrix; D3DXMatrixTranslation(&translationMatrix, position.x, position.y, position.z); D3DXMATRIX identityMatrix; D3DXMatrixIdentity(&identityMatrix); DWORD dummyFvf = D3DFVF_XYZ | D3DFVF_DIFFUSE; graphics->SetVertexFormat(dummyFvf); graphics->DisableLighting(); graphics->SetModelMatrix(&translationMatrix); graphics->DrawImmediate(D3DPT_LINESTRIP, 4, &square[0], sizeof(square[0])); graphics->SetModelMatrix(&identityMatrix); graphics->EnableLighting(); } Bullet.cpp #include "Game.h" #include "System.h" #include "OrthoCamera.h" #include "Background.h" #include "Ship.h" #include "Asteroid.h" #include "Explosion.h" #include "Keyboard.h" #include "Random.h" #include "Maths.h" #include "Bullet.h" #include "Collision.h" #include <algorithm> Game::Game() : camera_(0), background_(0), player_(0), collision_(0) { camera_ = new OrthoCamera(); camera_->SetPosition(D3DXVECTOR3(0.0f, 0.0f, 0.0f)); camera_->SetFrustum(800.0f, 600.0f, -100.0f, 100.0f); background_ = new Background(800.0f, 600.0f); collision_ = new Collision(); } Game::~Game() { delete camera_; delete background_; delete player_; DeleteBullet(); DeleteAllAsteroids(); DeleteAllExplosions(); delete collision_; } void Game::Update(System *system) { UpdatePlayer(system); UpdateAsteroids(system); UpdateBullet(system); UpdateCollisions(); } void Game::RenderBackgroundOnly(Graphics *graphics) { camera_->SetAsView(graphics); background_->Render(graphics); } void Game::RenderEverything(Graphics *graphics) { camera_->SetAsView(graphics); background_->Render(graphics); if (player_) { player_->Render(graphics); } for (AsteroidList::const_iterator asteroidIt = asteroids_.begin(), end = asteroids_.end(); asteroidIt != end; ++asteroidIt) { (*asteroidIt)->Render(graphics); } if (bullet_) //**TODO: Candidate for crash { bullet_->Render(graphics); } for (ExplosionList::const_iterator explosionIt = explosions_.begin(), end = explosions_.end(); explosionIt != end; ++explosionIt) { (*explosionIt)->Render(graphics); } } void Game::InitialiseLevel(int numAsteroids) { DeleteAllAsteroids(); DeleteAllExplosions(); SpawnPlayer(); SpawnAsteroids(numAsteroids); } bool Game::IsLevelComplete() const { return (asteroids_.empty() && explosions_.empty()); } bool Game::IsGameOver() const { return (player_ == 0 && explosions_.empty()); } void Game::DoCollision(GameEntity *a, GameEntity *b) { Ship *player = static_cast<Ship *>(a == player_ ? a : (b == player_ ? b : 0)); Bullet *bullet = static_cast<Bullet *>(a == bullet_ ? a : (b == bullet_ ? b : 0)); Asteroid *asteroid = static_cast<Asteroid *>(IsAsteroid(a) ? a : (IsAsteroid(b) ? b : 0)); if (player && asteroid) { AsteroidHit(asteroid); DeletePlayer(); } if (bullet && asteroid) { AsteroidHit(asteroid); DeleteBullet(); } } void Game::SpawnPlayer() { DeletePlayer(); player_ = new Ship(); player_->EnableCollisions(collision_, 10.0f); } void Game::DeletePlayer() { delete player_; player_ = 0; } void Game::UpdatePlayer(System *system) { if (player_ == 0) return; Keyboard *keyboard = system->GetKeyboard(); float acceleration = 0.0f; if (keyboard->IsKeyHeld(VK_UP) || keyboard->IsKeyHeld('W')) { acceleration = 1.0f; } else if (keyboard->IsKeyHeld(VK_DOWN) || keyboard->IsKeyHeld('S')) { acceleration = -1.0f; } float rotation = 0.0f; if (keyboard->IsKeyHeld(VK_RIGHT) || keyboard->IsKeyHeld('D')) { rotation = -1.0f; } else if (keyboard->IsKeyHeld(VK_LEFT) || keyboard->IsKeyHeld('A')) { rotation = 1.0f; } player_->SetControlInput(acceleration, rotation); player_->Update(system); WrapEntity(player_); if (keyboard->IsKeyPressed(VK_SPACE)) { D3DXVECTOR3 playerForward = player_->GetForwardVector(); D3DXVECTOR3 bulletPosition = player_->GetPosition() + playerForward * 10.0f; SpawnBullet(bulletPosition, playerForward); } } void Game::UpdateAsteroids(System *system) { for (AsteroidList::const_iterator asteroidIt = asteroids_.begin(), end = asteroids_.end(); asteroidIt != end; ++asteroidIt) { (*asteroidIt)->Update(system); WrapEntity(*asteroidIt); } } void Game::UpdateBullet(System *system) { if (bullet_) { bullet_->Update(system); WrapEntity(bullet_); } } void Game::WrapEntity(GameEntity *entity) const { D3DXVECTOR3 entityPosition = entity->GetPosition(); entityPosition.x = Maths::WrapModulo(entityPosition.x, -400.0f, 400.0f); entityPosition.y = Maths::WrapModulo(entityPosition.y, -300.0f, 300.0f); entity->SetPosition(entityPosition); } void Game::DeleteAllAsteroids() { for (AsteroidList::const_iterator asteroidIt = asteroids_.begin(), end = asteroids_.end(); asteroidIt != end; ++asteroidIt) { delete (*asteroidIt); } asteroids_.clear(); } void Game::DeleteAllExplosions() { for (ExplosionList::const_iterator explosionIt = explosions_.begin(), end = explosions_.end(); explosionIt != end; ++explosionIt) { delete (*explosionIt); } explosions_.clear(); } void Game::SpawnBullet(const D3DXVECTOR3 &position, const D3DXVECTOR3 &direction) { DeleteBullet(); bullet_ = new Bullet(position, direction); bullet_->EnableCollisions(collision_, 3.0f); } void Game::DeleteBullet() { delete bullet_; bullet_ = 0; } void Game::SpawnAsteroids(int numAsteroids) { float halfWidth = 800.0f * 0.5f; float halfHeight = 600.0f * 0.5f; for (int i = 0; i < numAsteroids; i++) { float x = Random::GetFloat(-halfWidth, halfWidth); float y = Random::GetFloat(-halfHeight, halfHeight); D3DXVECTOR3 position = D3DXVECTOR3(x, y, 0.0f); SpawnAsteroidAt(position, 3); } } void Game::SpawnAsteroidAt(const D3DXVECTOR3 &position, int size) { const float MAX_ASTEROID_SPEED = 1.0f; float angle = Random::GetFloat(Maths::TWO_PI); D3DXMATRIX randomRotation; D3DXMatrixRotationZ(&randomRotation, angle); D3DXVECTOR3 velocity = D3DXVECTOR3(0.0f, Random::GetFloat(MAX_ASTEROID_SPEED), 0.0f); D3DXVec3TransformNormal(&velocity, &velocity, &randomRotation); Asteroid *asteroid = new Asteroid(position, velocity, size); asteroid->EnableCollisions(collision_, size * 5.0f); asteroids_.push_back(asteroid); } bool Game::IsAsteroid(GameEntity *entity) const { return (std::find(asteroids_.begin(), asteroids_.end(), entity) != asteroids_.end()); } void Game::AsteroidHit(Asteroid *asteroid) { int oldSize = asteroid->GetSize(); if (oldSize > 1) { int smallerSize = oldSize -1; D3DXVECTOR3 position = asteroid->GetPosition(); SpawnAsteroidAt(position, smallerSize); SpawnAsteroidAt(position, smallerSize); } DeleteAsteroid(asteroid); } void Game::DeleteAsteroid(Asteroid *asteroid) { asteroids_.remove(asteroid); delete asteroid; } void Game::UpdateCollisions() { collision_->DoCollisions(this); } this is Game.cpp
  14. Hey guys, I am getting an exception when I run my code. It's an asteroid game and I am using VS2012 express for it. When I run my code I get this warning dialogue box and then it takes me to UpdateBullet function.
  15. Hello, I am using unity and I am confused on one part It's like I have three buttons out of which one has to be selected. If I have selected one of the three buttons during runtime and then I want to select the other button. How would Unity know that only one button has to be selected out of the three and unity has to disable the older selected button now? There must be some function to make unity know that it has to deselect the older option and select the newer one? I have attached a screen shot along with this. Thanks
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net 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!