Jump to content

  • Log In with Google      Sign In   
  • Create Account


iAmCodeMonkey

Member Since 07 Jun 2010
Offline Last Active May 03 2014 03:26 PM

Topics I've Started

collision detection and response issues...

09 August 2011 - 10:59 PM

Mods please delete thread. I fixed the problem. <_<

slight bug in my code...

02 January 2011 - 10:13 AM

Hey!

I have encountered a slight bug in my game code, and I want some suggestions on how to track down the cause...

I am loading in my level data from a text file with this format:

AMOUNT 12
asteroid 600 400
asteroid 1400 200
asteroid 1000 600
asteroid 1600 600
asteroid 1400 600
asteroid 1200 200
asteroid 1600 400
asteroid 400 200
asteroid 200 300
asteroid 400 600
asteroid 1100 300
asteroid 1500 300
...

where AMOUNT denotes that the total amount of entities for the level is beside that marker, and below that is the entity name and the x\y co-ordinates for each instance.

The problem that I am having is that my code does not seem to be rendering all of the entities in the file, after having loaded them into an STL vector. I am keeping track of the number of entities killed by the player, and I decrement that value each time an asteroid gets destroyed. But the number being rendered on screen, the amount\number specified in the text file, and the entity counter do not match up.

For example, I had 12 asteroids in the file to start off with, and after I killed them all, my entity counter was at 4... where did the other entities go???

-CodeMonkey

my game so far... Project X18

08 October 2010 - 06:55 PM

Here are some screen shots of my first game in progress.
Made using plain-old C++ and SDL + Extensions.
Please let me know what you think...

Image and video hosting by TinyPic

Image and video hosting by TinyPic

Image and video hosting by TinyPic

Image and video hosting by TinyPic

Episode One will come ASAP. I have software engineering in college to focus on right now, lol.

how to store\create\delete multiple enemies???

03 September 2010 - 08:12 PM

I now have my player starting point being loaded from a text file(:O!), and I want to know what is the best way to handle more than one instance of the same enemy type in a 2D map?

Now, my game is not going to be tile based, rather, I would like to extend my engine to include scrolling aka Lazy Foo Tutorial #21, and have a set exit point as a class that can make collisions with the player at the end of a level, with the various enemies being spawned at specific x/y points on the map.

Would storing the enemy classes in a vector be a good choice?

Some code examples would help, as well.

bullet moving with player sprite

17 August 2010 - 04:56 PM

Hi!

I am now able to move a bullet across the screen via NickGravelyn's post here: http://www.gamedev.net/community/forums/topic.asp?topic_id=380062

I am now having some trouble to make the bullet sprite move around with the player ship, as my code sits now, the bullet will fire from where-ever the co-ordinates are set in the fire() function (passed in as parameters)... my player ship can move around freely, but the bullet stays in one direction on the x-axis.

Any suggestions as on how to rectify this? My bullet movement code is below...


void bulletClass::bulletInput(void) {

float centerVal = 0.0;

playerClass p;

/* if a key was pressed */
if ( gameEvent.type == SDL_KEYDOWN ) {

SDLKey keyPressed = gameEvent.key.keysym.sym;

/* alter velocity\fire bullet\change weapon */
switch(keyPressed) {
case SDLK_LEFT:
;
break;
case SDLK_RIGHT:
;
break;
case SDLK_UP:
;
break;
case SDLK_DOWN:
;
break;
case SDLK_SPACE:
/* if the bullet is not created, fire it */
if ( (isCreated == false) ) {
fireBullet(BULLET_SPEED, 0.0, (float)p.getPlayerBox().x,
(float)p.getPlayerBox().y, bulletSize);
} /* end if */
break;
case SDLK_1:
/* if the bullet is not created, set weapon */
if ( (isCreated == false) ) {
oneSelected = true;
twoSelected = false;
threeSelected = false;
bulletSize = BULLET_ONE;
centerVal = 3.0;
} /* end if */
break;
case SDLK_2:
/* if the bullet is not created, set weapon */
if ( (isCreated == false) ) {
oneSelected = false;
twoSelected = true;
threeSelected = false;
bulletSize = BULLET_TWO;
centerVal = 6.5;
} /* end if */
break;
case SDLK_3:
/* if the bullet is not created, set weapon */
if ( (isCreated == false) ) {
oneSelected = false;
twoSelected = false;
threeSelected = true;
bulletSize = BULLET_THREE;
centerVal = 3.5;
} /* end if */
break;
} /* end switch */

/* if a key was released */
} else if ( gameEvent.type == SDL_KEYUP ) {

SDLKey keyPressed = gameEvent.key.keysym.sym;

/* alter velocity\fire bullet\change weapon */
switch(keyPressed) {
case SDLK_LEFT:
;
break;
case SDLK_RIGHT:
;
break;
case SDLK_UP:
;
break;
case SDLK_DOWN:
;
break;
case SDLK_1:
/* if the bullet is not created, set weapon */
if ( (isCreated == false) ) {
oneSelected = true;
twoSelected = false;
threeSelected = false;
bulletSize = BULLET_ONE;
} /* end if */
break;
case SDLK_2:
/* if the bullet is not created, set weapon */
if ( (isCreated == false) ) {
oneSelected = false;
twoSelected = true;
threeSelected = false;
bulletSize = BULLET_TWO;
} /* end if */
break;
case SDLK_3:
/* if the bullet is not created, set weapon */
if ( (isCreated == false) ) {
oneSelected = false;
twoSelected = false;
threeSelected = true;
bulletSize = BULLET_THREE;
} /* end if */
break;
} /* end switch */

} /* end if */

} /* end bulletInput() */
[\source]


[Edited by - iAmCodeMonkey on August 19, 2010 9:20:41 PM]

PARTNERS