2 Replies - 2216 Views - Last Post: 29 May 2009 - 07:37 PM Rate Topic: -----

#1 Zardinus  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 27
  • Joined: 14-May 09

problem with snake game

Posted 21 May 2009 - 12:12 AM

Greeting everyone ..!!

Actually I need a little help .. I'm trying to make a simple snake game with C++ I have already set all the basics where the snake will be assigned in two dimentional array .. but I have only one problem .. it is to change the direction of the snake while it is moving .. you know how does the snake moves or acts in snake game !! but in C/C++ the program will not display any thing or proceed any process when using input command or function like scanf ,getchar. getch etc .. until the user input a character or hit a key (as a I know) .. did you get me? when the snake is moving I want the snake to keep moving whenever I hit a key to change its dirrection ...

so If you know anyway to help I will be glad to tell me ..

Thanks for advance ..

Is This A Good Question/Topic? 0
  • +

Replies To: problem with snake game

#2 SixOfEleven  Icon User is offline

  • using Caffeine;
  • member icon

Reputation: 945
  • View blog
  • Posts: 6,342
  • Joined: 18-October 08

Re: problem with snake game

Posted 22 May 2009 - 05:10 PM

Are you doing it in console mode, SDL or whatever?

It would help a lot if you posted the code that you were having problems with in tags.

:code:
Was This Post Helpful? 0
  • +
  • -

#3 hollingsworthdan  Icon User is offline

  • New D.I.C Head

Reputation: 2
  • View blog
  • Posts: 18
  • Joined: 22-May 09

Re: problem with snake game

Posted 29 May 2009 - 07:37 PM

Look for :


int inKey = 0;

if (kbhit()) {

	inKey = getch();

}



Was This Post Helpful? 0
  • +
  • -

Page 1 of 1