Please help me in my project!!

This is a discussion on Please help me in my project!! within the C++ Programming forums, part of the General Programming Boards category; Actually , i am making a game in C using graphics.h game have 2 parts ie. a bucket which is ...

  1. #1
    Registered User
    Join Date
    Nov 2013
    Posts
    5

    Please help me in my project!!

    Actually , i am making a game in C using graphics.h
    game have 2 parts ie. a bucket which is at the bottom which will accept balls coming from the top of screen!!

    So game is ball in bucket!
    if the co-ordinates of ball lies inside the bucket it means that ball has fallen into the bucket.

    Else not!!

    I have given 2 option for bucket that is, A and D to shift the bucket on x axis!!
    My problem starts here:

    In main i have 2 fuctions ie.
    position()- which accepts ch=getch() value and checks that is it A or D and move the bucket accordingly!!
    And randomizer ()- which can randomly makes circle at random x and y increasing (falling from top).

    My problem is how can i achieve that if user doesn't press anything in during ch=getch() then after 1 sec my next line(fuction) of randomizer() will execute!!

    I hope you got it!!!

  2. #2
    Registered User
    Join Date
    Aug 2010
    Location
    Poland
    Posts
    681
    Why do you create a topic for C++ if you claim that your game is in C?

    Anyway, what you want to do is platform-specific, which means that you need a 3rd party library to do this. Here is something that might help: linux - Non-blocking getch(), ncurses - Stack Overflow

    Google for "non-blocking keyboard input in C" or similar.
    I never put signature, but I decided to make an exception.

  3. #3
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,434
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 4
    Last Post: 08-02-2013, 06:45 PM
  2. Replies: 5
    Last Post: 02-23-2013, 02:37 PM
  3. Classes Project (Not class project)
    By adam.morin in forum C++ Programming
    Replies: 3
    Last Post: 02-28-2011, 12:48 AM
  4. Paid project - The Free Marketing Project
    By sharefree in forum Projects and Job Recruitment
    Replies: 0
    Last Post: 10-27-2010, 02:15 PM
  5. your 11th & 12th grade c++ project or similar project
    By sleepyheadtony in forum A Brief History of Cprogramming.com
    Replies: 12
    Last Post: 01-13-2002, 04:14 PM

Tags for this Thread


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21