Sorry, but as you can read in this thread yourself you weren't able to handle easy stuff properly (or not at all). You simply copy/pasted the examples given to you which were meant to be studied and above all to be adapted to your own program instead.
So, in order to explain how to do such things as you ask, we need to write a book, as you don't have any basis.
quote:
Originally posted by Ezra
start with the easy stuff, learn why things behave like they do, and work onwards from that.
(...)
Just take it one step at a time, and you'll learn much quicker and better