Thread: Expression preceding parethenses?

  1. #61
    Registered User
    Join Date
    Oct 2017
    Posts
    33
    Quote Originally Posted by john.c View Post
    Presumably your overall algorithm is something like:
    Code:
    Loop:
      Draw paddles and ball
      Check for user input and update user paddle position
      Calc computer action and update computer paddle position
      Update ball position
    So if you put a delay in the computer's move, it will delay everything, unless your app is multi-threaded.
    So how am I supposed to delay it without delaying everything, there must be some way

  2. #62
    Banned
    Join Date
    Aug 2017
    Posts
    861
    Quote Originally Posted by nothing909 View Post
    So how am I supposed to delay it without delaying everything, there must be some way
    you'd have to use something other that something that slows down the entire game, like a separate (second) algorithm that makes the paddle miss track the ball so it misses it every so often. Then goes back to the primary algorithm that keeps track of the ball.

    Or one algorithm that has a burp in it so it miss tracks the ball every so often while running.

    IE, during the following of the ball, it loses it, it could move quickly up or down making it look like it was trying to put a spin on the ball but misses the ball instead.

    Think of real life situations of racket ball even in terms of how one hits the racket ball with the paddle, then try to put that into a programming language within your game to imitate real life. AI
    Last edited by userxbw; 12-11-2017 at 07:28 AM.

  3. #63
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,666
    One of the main difficulties is the OP only began programming "2 days ago", yet apparently they have "tons of it with many different libraries.", not to mention the added difficulty of "i'm programming a microcontroller".

    My guess is, they "found" a whole mess of code just because it implemented what they want, but it far outstrips the original requirements (them been an ultra-noob and so on), and they have no clue whatsoever how to proceed.

    The fact that post#17 happened (again) when I'd already explained the problem in post #7 shows they're not really up to the task.

    @OP, if this is an accurate description, then throw away your found code and concentrate on implementing your requirements in your own way at a skill level appropriate to you.

    Not to mention the comical suggestions of "dos.h" and "unistd.h" when it was already established that the OP is "programming a microcontroller".

    This stumble-fest is over 60 replies long ffs.
    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.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Rotation independent of preceding rotations (DirectX)
    By blakeo_x in forum Game Programming
    Replies: 12
    Last Post: 10-03-2012, 05:23 PM
  2. initializer expression list treated as compound expression
    By karthikeyanvisu in forum C Programming
    Replies: 7
    Last Post: 02-26-2011, 05:19 PM
  3. Replies: 2
    Last Post: 11-25-2009, 07:38 AM
  4. preceding zeros in int variables
    By AshFooYoung in forum C Programming
    Replies: 2
    Last Post: 09-23-2001, 02:28 PM
  5. Preceding 0
    By morbuz in forum C++ Programming
    Replies: 2
    Last Post: 09-19-2001, 12:15 PM

Tags for this Thread