first of all, I wanna say hi to u all as I'm new to daniweb. I'm a freshman in a college so I don't know much of c yet. So please be understanding in case that I will ask some n00b question later on :)
So this is my problem...first one
I was using this code to get input from player to move the pad right and left

    mov='s'; //supposed to be null, need more knowledge about \0
    gotoxy(x,y);puts(pad);/*supposed to remove the cursor if it's possible. Ended up using puts to make the cursor less noticeable*/
    if(mov='d')//supposed to be right arrow, don't know how to
    else if(mov='a')//supposed to be left arrow

but I ended up getting right movement with anykey pressed

also another problem is getting the ball move as the time passed (I have no idea how to)

Recommended Answers

All 7 Replies

> mov==getch();
> if(mov='d')//supposed to be right arrow, don't know how to
You got them both wrong
= is for assignment (the first one)
== is for comparison (the second one)

Yay...thanks, Salem
New things for me :)

but how about my second question about time-based movement? or rather I called GUI in C? is it even possible? if it is, please refer me to the materials.

thanks a bunch though ^^

Which OS / Compiler are you using?

Sure it's possible, but it won't be standard C anymore.

I'm using Borland C++ 5.0 in windows xp
I'm not sure which version my compiler is though...
What do you mean about not standard C anymore? Is it about making and using custom library? I've downloaded a source of snake game and I saw some custom *.h files included in it...what I'm curious about is how to produce our own library, I mean what kind of IDE supports making of *.h library? Can you provide me some simple examples of *.h source?
I'm sorry for asking so much question XD

> What do you mean about not standard C anymore?
Meaning you can no longer pick a random C compiler (say for your Cray supercomputer or your mobile phone), and have your program work on all of them.

> Is it about making and using custom library?
Not necessarily. It could just be using the header files which describe the API of the OS you happen to be using. The Win32 API for example has many useful things which could be used to solve this problem.

Check out the console tutorials here

I almost got headache. No doubt it is not standard C anymore. I haven't solved my problem yet, but as it's too advanced for me to solve, let's suppose it's solved. At least I know where to find tutorial if I confuse myself with this kind of problem in the future.

Again, Tons of Thanks to Salem :)

-Problem's solved-

what is the right code to this? thank you!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.