bluwind

Members
  • Content count

    25
  • Joined

  • Last visited

Community Reputation

181 Neutral

About bluwind

  • Rank
    Member
  1. Here in Nottingham uk we have just had a crytek studio open up across from my workplace. Everyday I have to sit there starring at their god damn logos teasing me about my dream job that I probibly won't ever get.. Haha..
  2. Fleet Limit

        regarding -"a ship is destroyed", I would personally assign different 'escape pod' values to each type of ship (if your using different types of ship). so say a cruiser may be able to save 20 % of its crew while a science vessel my save 50%. if your, that way your saving some of the crew but still giving the player a reason to not letting his ships die.   -"a ship is damaged", this depends entirely on how realistic your making this. it would be one idea to make the crew move to new ships regardless of if the older ship is damaged - after all you don't see the navy still putting out wooden sailing ships. Then again you could have a crew experience field - which increases the ships capability the longer it has served on a vessel. which would mean you would want the crew to return to the older ship once it has been repaired. again my preference would be to have the crew make a permanent move to a new ship every third generation of ship and a temp move while repairs are being made before that, I would also put in the experience field.
  3. Ok, so this is my first C++ code, I am not making any excuses though because I have been programming off and on in VB for a few years so I am aware of a number of bad practises I committed here. So here is some code for you to feast your eyes upon, you can see how I jumped from one preferred grid referencing method to another, Coordsx, VX, GridRefx... that's what happens when you don't have a clear plan though. I am currently restarting the project in a much more manageable way because even I have lost track of what is going on in may sections. I posted the game running (or at least doing a good imitation of running) on youtube here http://www.youtube.com/watch?v=Hp5wsjfUNjY The game is a Viking raiders (spectrum) remake. int Player1::Check_Collision(int Directions) { int i; switch (Directions) { case 1: //Bottom Left if (Coordsx - vx <= -30 || Coordsy + vy >= (SCREEN_HEIGHT - 90) || Map[GridRefx - 1][GridRefy + 1].style == 1 || Map[GridRefx - 1][GridRefy + 1].Occupied == 1) { if (Map[GridRefx - 1][GridRefy + 1].Occupied == 1) { Fighting = true; Stepinto = 2; AnimOverlord = 0; } LockPSel = false; Active = false; Direction = 0; return 1; } break; //Down case 2: if (Coordsy + vy >= (SCREEN_HEIGHT - 90) || Map[GridRefx][GridRefy + 1].style == 1 || Map[GridRefx][GridRefy + 1].Occupied == 1) { if (Map[GridRefx][GridRefy + 1].Occupied == 1) { Fighting = true; Stepinto = 2; AnimOverlord = 0; } Direction = 0; LockPSel = false; Active = false; return 1; } break; case 3: //Bottom Right if (Coordsx + vx >= SCREEN_WIDTH || Coordsy + vy >= (SCREEN_HEIGHT - 90) || Map[GridRefx + 1][GridRefy + 1].style == 1 || Map[GridRefx + 1][GridRefy + 1].Occupied == 1) { if (Map[GridRefx + 1][GridRefy + 1].Occupied == 1) { Fighting = true; Stepinto = 2; AnimOverlord = 0; } Direction = 0; LockPSel = false; Active = false; return 1; } break; case 4: //left if (Coordsx - vx <= -30 || Map[GridRefx - 1][GridRefy].style == 1 || Map[GridRefx - 1][GridRefy].Occupied == 1) { if (Map[GridRefx - 1][GridRefy].Occupied == 1) { Fighting = true; Stepinto = 2; AnimOverlord = 0; } Direction = 0; LockPSel = false; Active = false; return 1; } break; case 6: //right if (Coordsx + vx >= SCREEN_WIDTH || Map[GridRefx + 1][GridRefy].style == 1 || Map[GridRefx + 1][GridRefy].Occupied == 1 ) { if (Map[GridRefx + 1][GridRefy].Occupied == 1) { Fighting = true; Stepinto = 2; AnimOverlord = 0; } Direction = 0; LockPSel = false; Active = false; return 1; } break; case 7: //top left if (Coordsx - vx <= -30 || Coordsy - vy <= -30 || Map[GridRefx - 1][GridRefy - 1].style == 1 || Map[GridRefx - 1][GridRefy - 1].Occupied == 1) { if (Map[GridRefx - 1][GridRefy - 1].Occupied == 1) { Fighting = true; Stepinto = 2; AnimOverlord = 0; } Direction = 0; LockPSel = false; Active = false; return 1; } break; case 8: //up if (Coordsy - vy <= -30 || Map[GridRefx][GridRefy - 1].style == 1 || Map[GridRefx][GridRefy - 1].Occupied == 1 ) { if (Map[GridRefx][GridRefy - 1].Occupied == 1) { Fighting = true; Stepinto = 2; AnimationCycle = true; AnimOverlord = 0; } Direction = 0; LockPSel = false; Active = false; return 1; } break; case 9: //top right if (Coordsx +vx >= SCREEN_WIDTH || Coordsy - vy <= -30 || Map[GridRefx + 1][GridRefy - 1].style == 1 || Map[GridRefx + 1][GridRefy - 1].Occupied == 1) { if (Map[GridRefx + 1][GridRefy - 1].Occupied == 1) { Fighting = true; Stepinto = 2; AnimationCycle = true; AnimOverlord = 0; } Direction = 0; LockPSel = false; Active = false; return 1; } break; } return 0; }
  4. Back to the grindstone

    Lol, aye FLeBlanc. I must admit I have been looking though a few other peoples - all looks neater and better written than mine, I was actual on the bus when I read Alpha's reply and I gave out a little WTF. But I fixed the second problem too :D.. games looking good now.. anyway... if I get time I will post up the code to this particular coding horror :D..
  5. Back to the grindstone

    Lmao. Wasn't expecting a debate and a small fire to break, I. Said that I was experience a coding horror of my own. I must have missed the sticky that specified "must contain code", it is very rare I will actually ask for help with code.Only when I knows piece of code should be working but doesn't and I need an extra set of eyes will I ask for help. And the " have sorted it"reply was simply in response to the per defined expected level of happiness at solving the problem. Didn't feel a need to post my solution as I never posted a problem, if u believe I posted in the wrong forum then please assist me with directions to a more appropriate place. Oh an on a different note, please feel free to head over to the beginner section as I am possibly going to post p another little problem if I can't work out a solution soon.
  6. Artifictial Society Simulation

    This is defiantly feasible, seeing as u don't ever plan on releasing the project u can start by thinking small. If it was me I would forgo the graphics for the time being and begin by displaying each agent as a coloured dot on he screen. Also start with the basics, hunger, fatigue and lifespan. Make food readily available and then slowly add extra avenues and routines. Sounds really fun though.
  7. Back to the grindstone

    Yey I fixed it... "puts on his cool shades and struts"..   YEAH baby
  8. Back to the grindstone

    currently experiencing a Coding Horror - for the past three days I have been stuck on a section of my game which switches between different phases (buy menu - move cycle).. and no matter what I try it throws back trouble. Its going to make me that much more happier with the finished product though in the end.. so ummm yeah.. back to it.
  9. Header file placement.

    thanks for the great comments guys. I'm going to spend a little time tonight going through information regarding putting globals in header files.
  10. Header file placement.

    Language is C++. Ok, so their is no such thing as a stupid question.. I know the Name says it all with "Header File", but does it matter where I include the header file - I am using header files to contain my different classes, E.G  Players.h, MapBuilder.h, GameLogic.h. You can pretty much guess what each header contains. Now because the Players.H file uses Global variables from my main .cpp I have #include the header file after the variables have been initialized. Will this cause me problems later down the line and if it will can someone point me in the direction of a better solution?.     Cheers Rob     ~~~~~~Please remember I am posting in the beginner forum for a reason - so please don't flame~~~~~~
  11. C++ SDL switch not working properly

    Crusable, you sir are a genius with the eyesight of the hawk, I have been looking at that code for hours and couldn't see the wood for the trees.. lol, yes, that was a stupid error on my part.. should have been .w for width .   Cheers buddy.
  12. Can anyone spot an error in this small code section?, when I separate it up and manual enter the coords for .x and .y it works fine, but as the clipboard size is likely to grow by quite a bit, I wanted to automate the loading process. The error I am getting is that when Blit-ing a clip that's loaded in the for loop - its coming up blank. my loaded graphic (clipboard) has 7 images across and 4 images down, each image is 30 pixels across. anyway the code : void Player1::Set_CLips() { int i,n; for (i=0; i < totalFrames; i++) { switch(i) { case 0: case 1: case 2: case 3: case 4: case 5: case 6: CLip[i].x = (i * 30); CLip[i].y = 0; CLip[i].h = 30; CLip[i].y = 30; break; case 7:case 8:case 9:case 10:case 11:case 12:case 13: n = i-7; CLip[i].x = (n * 30); CLip[i].y = 31; CLip[i].h = 30; CLip[i].y = 30; break; case 14:case 15:case 16: case 17:case 18:case 19:case 20: n = i - 14; CLip[i].x = (n * 30); CLip[i].y = 61; CLip[i].h = 30; CLip[i].y = 30; break; case 21:case 22:case 23:case 24:case 25:case 26:case 27: n = i - 21; CLip[i].x = (n * 30); CLip[i].y = 91; CLip[i].h = 30; CLip[i].y = 30; break; } } }
  13. I have come across this problem before when making maze games in VB. I found the problem is caused by moving first and then checking to see if a collision has happened. which is ok if the ball will be destroyed, but if your planning on bouncing it back in then your going to run into problems as the ball is then outside of the screen. So I would add a few extra lines to the code to check if a collision is going to happen before you move the ball. //Going Right if((ball.x + xdir) > (SCREEN_W - ball.radius)) {   xdir = -10;   ball.x = (SCREEN_W - ball.radius); }   //Going Left if((ball.x + xdir) < (0 +  ball.radius) ) { xdir = 10; ball.x = ball.radius; } //Now Move the ball ball.x += xdir;
  14. C++ Problem with loop

    don't worry, I have sorted it.. guess I woke up :D replaced Map[hor][ver].x = (hor * 30); Map[hor][ver].y = (ver * 30); with: Map[hor][ver].x = ((hor - 1) * 30); Map[hor][ver].y = ((ver - 1) * 30);     Thank you for taking the time to look and I wouldn't have sorted it if I didn't change to a for loop. so cheers again
  15. C++ Problem with loop

    Hi rnlf, thanks for the speedy reply there. I have just been adding to the programming as I have been going without tidying up my code as I go, as for the while loops - I think that's because I come from a vb6 background and its what I feel comfy with :D. but point taken. here is the tidy and less bloated code, still getting the same problem though - no map tile drawn to top left of screen, cords would be x=0, y=0.   void Build_Map() { int hor,ver; for (hor =0; hor <MAP_SIZE; hor++) { for (ver = 0; ver < MAP_SIZE; ver++) { Map[hor][ver].x = (hor * 30); Map[hor][ver].y = (ver * 30); Map[hor][ver].Set_CLips(); } } } int Drawtoscreen() { apply_surface(0,0,background, screen); int hor =0,ver = 0; for (hor =0; hor <MAP_SIZE; hor++) { for (ver = 0; ver <MAP_SIZE; ver++) { apply_surface(Map[hor][ver].x ,Map[hor][ver].y , Clipboard[1] , screen , &Map[hor][ver].CLip[2]); } } apply_surface(0,(SCREEN_HEIGHT - 28), message, screen); apply_surface(player.Coordsx , player.Coordsy , Clipboard[0], screen, &player.CLip[ player.ImageChoice ] ); return 0; }