Jump to content

  • Log In with Google      Sign In   
  • Create Account

BeerNutts

Member Since 27 Jun 2001
Offline Last Active Oct 23 2014 09:07 PM

Posts I've Made

In Topic: Two-dimensional array, finding a unknown index

23 October 2014 - 03:21 PM

There's a lot wrong with your code.  It's really too much to cover in one post.

 

You need to go over the code yourself, and find the logic errors.  A few obvious ones are, "rows" should correspond to y axis, and "columns" to x, you're setting island[rows/2, column/2] = 'D' but your Drunk guy should be at island[DrunkX, DrunkY].  The 1st line of "MoveDrunk" you check is the drunk guys is on a 'B' tile, but it will obviously have to be a 'D' tile.  Your else if after checking if he's on a 'B' tile is to check if he's on a 'B' tile!!

 

You really need to go over it yourself, or, if you're still stuck, try a smaller exercise 1st.  You're normal game loop should be somethig like this:

GameInitialize(); // Setup the land, water, bridges, and drunk guy spot
 
while (IsAlive)
{
  UpdateDrunkGuy();
  CheckDrunkGuyAlive();
  DrawGame();
}

 

Good luck, and keep at it, you'll get it, and things will come together soon.


In Topic: Two-dimensional array, finding a unknown index

22 October 2014 - 05:00 PM

Use another variable, int DrunkGuyX and int DrunkGuyY.  Initialize them to a random value between 0 and column-1 (or rows-1).  Then pass those variables to the MoveDrunk() function.  You'd then modify DrunkGuyX and DrunkGuyY as he moves around the island.
 
Good luck and have fun.
 
Oh, BTW, you should use the
[code]source code here [ /code ] (no spaces on close)
when entering code. It makes it look much better

In Topic: SFML Bounding box but how to implment collision with side detection?

22 October 2014 - 02:40 PM

My suggestion for these kinds of questions is to move the objects in a single axis (say X-axis, so horizontal) and check collision.  If collided, you know it hit from the side.  Then move on the other axis, and check it's collision.

 

Yes, it double the number of collision checks, but it is very accurate w/respect to finding out which side has collided, and its easy to implement.

 

Gopd luck and have fun.


In Topic: Can you give me an example shows the meaning of the concept?

17 October 2014 - 12:14 PM

Phil...is that you?


In Topic: Discussion about technologies used in MMO video games through browsers and mo...

16 October 2014 - 12:51 PM

This probably isn't what you are looking for, but, IMO, what the client uses to play a game (browser, mobile, desktop app, etc.) is becoming more and more heterogeneous and has little bearing on how an MMO is programmed.

 

Most of the work on an MMO will be server side.  The clients really do little besides render the world as the server has told it currently exists, process inputs, and feed that information back to the server.  Repeat.


PARTNERS